Amazon S3 provider credentials must be set under s3Options
Page summary:In Strapi 5, the Amazon S3 upload provider options must be nested under an
s3Optionsobject, and credentials should be passed inside acredentialsobject.
In Strapi 5, the Amazon S3 provider (@strapi/provider-upload-aws-s3) uses AWS SDK v3, which changes where credentials and other client options are configured.
This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
Breaking change description
In Strapi v4
Options such as accessKeyId, secretAccessKey, region and params could be passed directly under providerOptions, with no s3Options key.
providerOptions: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: env('AWS_BUCKET'),
},
},
In Strapi 5
Those options must be nested inside an s3Options object, and credentials should be wrapped in a credentials object. Placing accessKeyId/secretAccessKey at the root of s3Options still works but triggers a deprecation warning.
providerOptions: {
s3Options: {
credentials: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
},
region: env('AWS_REGION'),
params: {
Bucket: env('AWS_BUCKET'),
},
},
},
Migration
This section regroups useful notes and procedures about the introduced breaking change.
Notes
- See the Amazon S3 provider configuration documentation for complete examples.
Manual procedure
If you are upgrading an Amazon S3 configuration from Strapi v4:
- Nest
accessKeyId,secretAccessKey,region,params(and any other S3 client options) inside ans3Optionsobject underproviderOptions. - Move
accessKeyIdandsecretAccessKeyinto acredentialsobject withins3Options. Leaving them at the root ofs3Optionsstill works but is deprecated and triggers a warning.