Open ciriousjoker opened 1 year ago
@jimrowetpa has a fork which works great (apart from a missing dependency which I created a PR for), maybe this can be merged?
@ciriousjoker I am also trying to use the same plugin to have multiple providers (basically different bucket for different mime types) but it's not uploading any file to S3. It's just uploading the files to local. I am using the Strapi V4 and not seeing any error on the console. Can you please help me on this?
@ciriousjoker Please find the plugins configuration
module.exports = ({ env }) => ({
upload: {
logger:console,
provider: "multiple-provider",
providerOptions: {
selectProvider(file) {
if(file.name.match(/\.(jpe?g|png|webp|svg)$/))
return 'images'
else
return 'default'
},
providers:{
'images':{
provider: 'aws-s3',
options: {
providerOptions :{
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: '<bucket-name>',
cdn: env('AWS_CDN_DOMAIN'),
},
logger: console,
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
}
}
},
'default':{
provider: 'aws-s3',
options: {
providerOptions :{
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: '<bucket-name>',
cdn: env('AWS_CDN_DOMAIN'),
},
logger: console,
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
}
}
}
}
}
},
});
No idea how to help you sorry
@spshukla My config of the providers looks different. Not sure why but this was working a few months ago. Perhaps changes to Stapi?
config: {
provider: 'strapi-provider-upload-multiple-provider',
providerOptions: {
selectProvider(file) {
if (file.name.match(/\.(mp4|mov|wmv|avi|mkv|webm)$/))
return 'video'
else
return 'default'
},
providers: {
'default': {
provider: '@strapi/provider-upload-aws-s3',
options: {
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
Bucket: env('AWS_BUCKET'),
},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
}
},
'video': {
provider: 'strapi-provider-upload-vimeo',
options: {
accessToken: env('VIMEO_ACCESS_TOKEN'),
clientSecret: env('VIMEO_CLIENT_SECRET'),
clientId: env('VIMEO_CLIENT_ID'),
folderId: env('VIMEO_FOLDER_ID')
}
}
}
}
}
Error message: