- Strapi Version: 4.5.1
- Operating System: Linux Debian 11
- Database: Mysql
- Node Version: 16.18.1
-
NPM Version: 9.2.0
I am trying to upload media to my bucket stored in google cloud. I followed the cloud storage provider documentation, but the error throwserror 500
realated to myhttps://www.domain.com/upload
.
Here is my package.json
"dependencies": {
"@strapi-community/strapi-provider-upload-google-cloud-storage": "^4.3.6",
"@strapi/plugin-i18n": "4.5.1",
"@strapi/plugin-users-permissions": "4.5.1",
"@strapi/provider-email-nodemailer": "^4.5.3",
"@strapi/strapi": "4.5.1",
"axios": "^1.2.0",
"dotenv": "^16.0.1",
"mysql": "2.18.1",
"sharp": "^0.31.3",
"strapi-utils": "^3.6.11"
},
Here is my plugins.js
module.exports = {
upload: {
config: {
provider: '@strapi-community/strapi-provider-upload-google-cloud-storage',
providerOptions: {
bucketName: 'bucketname',
publicFiles: true,
uniform: true,
baseUrl: 'https://storage.googleapis.com/bucketname',
basePath: ''
},
},
},
}
Here is my middlewares.js
module.exports = [
'strapi::errors',{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'connect-src': ["'self'", 'https:'],
'img-src': ["'self'", 'data:', 'blob:', 'https://storage.googleapis.com','https://dl.airtable.com'],
'media-src': ["'self'", 'data:', 'blob:', 'https://storage.googleapis.com','https://dl.airtable.com'>
upgradeInsecureRequests: null,
},
},
},
},
{
name: 'strapi::cors',
config: {
enabled: true,
headers: '*',
origin: ['http://localhost:1337']
}
},
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
N: Before adding SSL I uploaded some images to the same bucket but i was not able to see those images so I think the bucket is working (because I could upload those images), now after adding security
in middlewares.js
i can see those images previously created but can not upload anything else