400 Bad request error when uploading files

System Information
  • Strapi Version: v4
  • Operating System: heroku dyno
  • Database: pg

Hi !
I’m trying to set up file upload to AWS S3 from Strapi deployed to a Heroku dyno.
I’ve tried it in local with no issue. However when I deploy to Heroku and try to upload an image to the media library from the admin, I get a 400 response with a ‘Files are empty’ message.
I use the default config from the @strapi/provider-upload-aws-s3 npm documentation.
I’m positive my env variables in the Heroku dyno are correct, I double checked.
I also tried the Cloudinary provider with the default config, and I had the exact same issue. (It was working in local but not on Heroku.)

I’m clueless as to what I’m doing wrong in the configuration…
Any help would be appreciated !

(Here’s a link to my repo for reference → link)

1 Like

Upon further inspection, the payload sent with the upload request is the following


so it makes sense that the backend responds with a 400.
I’m on Strapi 4.4.3.
This looks like a bug, should I open an issue on github ?


I kept watching this post for a response and decided to figure this on my own.
In my case, I had axios installed. I removed it and everything started to work.
I would suggest yarn rebuild afterwards.


That solved it for me as well, thanks for looking into it.