System Information
- Strapi v4
- PostgresDB
- S3 storage on-prem for media assets
I am using S3 storage and getting error 500 in Strapi admin when I am trying to upload media assets. When I check in the Strapi logs, I see the error “error: unable to verify the first certificate”.
If I don’t use S3 and don’t make these config changes, then I can upload media assets fine. But, in that case I don’t have persisting media storage.
I used Provider upload AWS S3 for uploading with the recommended settings as
config/plugins.js
module.exports = ({ env }) => ({
upload: {
config: {
provider: 'aws-s3',
providerOptions: {
endpoint: "https://my-onprem-url",
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: env('AWS_BUCKET'),
},
},
},
}
});
config/middlewares.js
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'connect-src': ["'self'", 'https:'],
'img-src': ["'self'", 'data:', 'blob:', 'https://my-onprem-url'],
'media-src': ["'self'", 'data:', 'blob:', 'https://my-onprem-url'],
upgradeInsecureRequests: null,
},
},
},
},
...
.env
AWS_ACCESS_KEY_ID="my-key-id"
AWS_ACCESS_SECRET="myaccesssecret"
AWS_REGION="aws-region"
AWS_BUCKET="my-bucket-name"
I have asked this question in Strapi discord community too but didn’t get a response there. This issue is blocking our progress, so any pointers/help will be appreciated.
Note- I did see that there was a similar question but the suggestions there didn’t work in my case.