amazon-s3aws-sdkstrapiobject-storage

Contabo Object Storage (S3) with Strapi CMS


I'm using Contabo Object Storage (compatible with S3) with Strapi CMS. For this purpose I'm using: @strapi/provider-upload-aws-s3

I've configured it like this (upload and delete works):

upload: {
  config: {
    provider: "aws-s3",
    providerOptions: {
      credentials: {
        accessKeyId: env("CONTABO_OBJECT_STORAGE_ACCESS_KEY"),
        secretAccessKey: env("CONTABO_OBJECT_STORAGE_SECRET_KEY"),
      },
      endpoint: env("CONTABO_OBJECT_STORAGE_ENDPOINT"),
      forcePathStyle: true,
      region: "default",
      params: {
        Bucket: env("CONTABO_OBJECT_STORAGE_BUCKET"),
      },
    },
  },
},

The typical S3 url looks like this:

https://s3.amazonaws.com/<MY BUCKET NAME>/filename.extension

And this is the format that Strapi expects:

https://eu2.contabostorage.com/xxx-bucket/yyy.jpeg

However in Contabo Object Storage the public urls look like this:

https://eu2.contabostorage.com/zzz:xxx-bucket/yyy.jpeg

where zzz is the tenantId I think, but I'm not sure

I'm not sure how or where to configure this. I'm hoping someone with more S3 and aws-sdk can help me with this


Solution

  • I solved this issue by simply adding the id to the bucket name and making the bucket public:

    CONTABO_OBJECT_STORAGE_BUCKET=zzz:xxx-bucket

    Now everything works as expected