Setup AWS S3 Provider for file uploads on Strapi v3

I’m very new to Strapi, and just started to play with it. Been following the official docs to install and configure the system, and while the base setup went without hiccups, getting something like the uploads provider strapi-provider-upload-aws-s3 - npm has proved to be a very different story.

For one the AWS provider documentation suggests using a JS config file located at ./config/plugins.js. When attempting that, the server tries to restart but crashes and cannot be restarted.

I’ve also noticed my install has all config files as .json, isolated per environment, while all the documentation I can find on the site only mentions .js files for all the configuration needs. Perhaps this is related to the fact I’m running the beta, but that was what the default installer gave me, I didn’t opt for a beta version.

I’ve tried converting the suggested configuration file from the provider plugin, placing the following at config/development/plugins.json:

  "upload": {
    "provider": "aws-s3",
    "providerOptions": {
      "accessKeyId": "${process.env.AWS_ACCESS_KEY_ID}",
      "secretAccessKey": "${process.env.AWS_ACCESS_SECRET}",
      "region": "${process.env.AWS_REGION}",
      "params": {
        "Bucket": "${process.env.AWS_BUCKET_NAME}"

This was accompanied with a new .env file I’ve added to the root of the project with the required environment variables.

Still, when I go to the Upload plugin settings, I only get the default “Local server” and a blank option for possible choices: CleanShot 2021-11-19 at 13.32.07

Any tips on how I can get this to work?

Also, why all the docs I can find use .js configuration files, whereas my install seems to only accept .json files?

Thanks so much for any help you can provide.

System Information
  • Strapi Version: v.3.0.0-beta.18.4
  • Operating System: macOS 12.0.1
  • Database: Postgres
  • Node Version: 14.17.1
  • NPM Version: 8.1.0
  • Yarn Version: 1.22.17

Since you are saying beta are you using V4 or you still on V3 as the title says v3.

The plugins.json location is wrong. correct location should be

Could you show how your ./config/plugins.js content please ? Note have you added the variables to .env since you are using the process for this ?

I’m running 3.0.0-beta.18.4 according to package.json and the info shown on the bottom left corner of the dashboard.

The /config folder does not hold any JS files on my install, it looks like this: CleanShot 2021-11-19 at 16.15.20

If I attempt to have a ./config/plugin.js file has noted on the provider docs the server crashes at restart with the following message:

[2021-11-19T16:16:48.242Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-19T16:16:48.243Z] error TypeError: Cannot read property 'defaultConnection' of undefined
    at module.exports (/Users/luismartins/Sites/strapi-admin/node_modules/strapi/lib/core/bootstrap.js:36:47)
    at Strapi.load (/Users/luismartins/Sites/strapi-admin/node_modules/strapi/lib/Strapi.js:353:11)
    at async Strapi.start (/Users/luismartins/Sites/strapi-admin/node_modules/strapi/lib/Strapi.js:196:7)
error Command failed with exit code 1.

I’m thinking this may be due to strapi versions mismatch, but what’s puzzling is that the version that I’m using is what the installing process described in the docs gives you.

So i would strongly advise you to upgrade further, v3 beta is no longer it’s now in stable 3.6.8
That’s the first step in my opinion, and then make sure you install the latest 3.6.8 S3 plugin too

Thank you @Eventyret, think I’m going to just start fresh.
I had installed the app using the CLI and for some reason I got that old beta version (this install was ran last week).
Just did another install and got 3.6.8 for all components as you mention.
Not sure what that was, but it was still a test install so that’s fine.

Thank you for pointing that out.

Please tell how to upload image on s3 using strapi API, specially on v3

You need to setup the plugin. And setup a bucket.
I believe the standard s3 bucket for S3 does not support Private buckets so if this is a requirement you want a community package.

For me it’s working on localhost but I can’t upload any files on my live strapi admin.

I have it hosted on Heroku. Does anyone know if I have to change anything for production?