zoomoid / strapi-provider-upload-aws-s3-advanced

A partial fork of https://github.com/strapi/strapi to extend the S3 Upload Provider to support path prefixes inside a bucket

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[v4] Endpoint not working

Tragio opened this issue Β· comments

Describe the bug
Hello @zoomoid πŸ‘‹ thank you for your work. I was using the Strapi S3 plugin and it was working but I need CDN so I moved for your own.

However, the endpoint seems not working. Because it's going to xxx.s3.us-west-002.amazonaws.com instead of the one I set on the endpoint.

error uploading object to s3 shows_thumbnail_6427cbb_0936efb5bfcfbc3a67c8c63b24ec77a8_1f37f7d009.jpg
Error: getaddrinfo ENOTFOUND xxx.s3.us-west-002.amazonaws.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'xxx.s3.us-west-002.amazonaws.com',
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}
[2022-01-09 23:20:48.543] error: getaddrinfo ENOTFOUND xxx.s3.us-west-002.amazonaws.com
Error: getaddrinfo ENOTFOUND xxx.s3.us-west-002.amazonaws.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

To Reproduce

  upload: {
    config: {
      provider: 'strapi-provider-upload-aws-s3-advanced',
      providerOptions: {
        accessKeyId: env('AWS_ACCESS_KEY_ID'),
        secretAccessKey: env('AWS_ACCESS_SECRET'),
        region: env('AWS_REGION'),
        endpoint: 's3.us-west-002.backblazeb2.com',
        params: {
          bucket: env('AWS_BUCKET'),
        },
        baseUrl: env('CDN_BASE_URL'),
      },
    },
  },

Thank you very much!! πŸ˜„

Hey @Tragio thank you for highlighting this, you are absolutely right, setting custom endpoints is something I had not considered up until your issue. The aws-sdk exposes a lot more configurability than this strapi plugin accounts and I like your proposition of using object spread to allow any configuration that the aws-sdk accepts πŸ‘

Will merge this at the soonest possible time, looks good!

It's a community 😁 glad to contribute!

Closing, as #4 is merged πŸ‘ thanks for your contribution