I was having trouble getting the configuration settings correct for the AWS credentials and was getting the same error. I also saw “bucket name missing” in the logs. So in case this helps save someone else some time, here is what happened to me. I’m sure this is obvious to the more experienced programmers out there.
I was entering the credentials incorrectly into the configuration file. I was editing ./config/plugins.js:
Here is the sample file from the guide:
module.exports = ({ env }) => ({
upload: {
provider: 'aws-s3',
providerOptions: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: 'aws-region',
params: {
Bucket: 'my-bucket',
},
},
},
});
So I was replacing what I thought were placeholder strings above. like this-
module.exports = ({ env }) => ({
upload: {
provider: 'aws-s3',
providerOptions: {
accessKeyId: env('FAKEISFJISJDISJD'),
secretAccessKey: env('FAKEOINAD%#$ONION(SBASMKNSKDNS^%#^%'),
region: 'us-west-1',
params: {
Bucket: 'bucketname',
},
},
},
});
That’s wrong - I realized you are setting environment variables and need the variable names! So you add the data after a comma like this:
module.exports = ({ env }) => ({
upload: {
provider: ‘aws-s3’,
providerOptions: {
accessKeyId: env(‘AWS_ACCESS_KEY_ID’, ‘FAKE6FHWIDHIWD4XPQ’),
secretAccessKey: env(‘AWS_ACCESS_SECRET’, ‘Fakeadsfi+IeidnansdVkbT6Ji8BIJiojafffa5gy5C0’),
region: env(‘AWS_REGION’, ‘us-west-1’),
params: {
Bucket: env(‘AWS_BUCKET_NAME’, ‘bucketname-strapi’),
},
},
},
});
SO the sample file really should look like this to be more clear:
module.exports = ({ env }) => ({
upload: {
provider: ‘aws-s3’,
providerOptions: {
accessKeyId: env(‘AWS_ACCESS_KEY_ID’, ‘Your_access_key’),
secretAccessKey: env(‘AWS_ACCESS_SECRET’, ‘Your_access_secret’),
region: env(‘AWS_REGION’, ‘us-west-1’),
params: {
Bucket: env(‘AWS_BUCKET_NAME’, ‘bucketname-strapi’),
},
},
},
});
Hope this save someone some time!