Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

payloadcms/storage-s3 custom endpoint not working

default discord avatar
joelcoreylast year
11

Like the title says. It just spits back a missing region error or expects to concatenate the region with a AWS endpoint that I have nothing to do with.





The question being: am I doing this correctly if I want to use something like Backblaze S3 bucket storage?



As in, do you use the storage-s3 plugin for non-AWS specific solutions?

  • discord user avatar
    denolfe
    last year

    There are people using min.io and cloudflare R2 successfully



    What do the backblaze docs say for configuring the region?

  • default discord avatar
    joelcoreylast year

    the region goes directly in to the url. Also the endpoint does not get respected. It actually tries to call the AWS endpoint/api.



    [15:58:35] ERROR: There was an error while uploading files corresponding to the collection media with filename images.png:
    [15:58:35] ERROR: getaddrinfo ENOTFOUND s3.us-west.amazonaws.com
        err: {
          "type": "Error",
          "message": "getaddrinfo ENOTFOUND s3.us-west.amazonaws.com",
          "stack":
              Error: getaddrinfo ENOTFOUND s3.us-west.amazonaws.com
                  at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
                  at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
          "errno": -3008,
          "code": "ENOTFOUND",
          "syscall": "getaddrinfo",
          "hostname": "s3.us-west.amazonaws.com",
          "$metadata": {
            "attempts": 1,
            "totalRetryDelay": 0
          }
        }
    [15:58:35] ERROR: Error: getaddrinfo ENOTFOUND s3.us-west.amazonaws.com
        at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
        at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
     POST /api/media?depth=0&fallback-locale=null 500 in 163ms


        plugins: [
          //@ts-ignore
        s3Storage({
          collections: {
                    ['media']: true
          },
                //@ts-ignore
          bucket: process.env.S3_BUCKET,
          config: {
                    credentials: {
                        //@ts-ignore
              accessKeyId: process.env.S3_ACCESS_KEY_ID,
                        //@ts-ignore
              secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
            },
                    endpoint: process.env.S3_ENDPOINT,
                    region: process.env.S3_REGION,
            forcePathStyle: true
          },
        }),
      ],
  • discord user avatar
    denolfe
    last year

    What is the endpoint set to?

  • discord user avatar
    denolfe
    last year

    And region is set to us-west-004?

  • default discord avatar
    joelcoreylast year

    umm. This may be something really dumb. Assuming console logs work in payload config, I am getting undefined when I try and echo out the endpoint.

  • default discord avatar
    joelcoreylast year

    O.M.F.G. there was a typo in the

    **

    env file



    you .. have to be .. just kill me.



    lol

  • discord user avatar
    denolfe
    last year

    😆

  • default discord avatar
    joelcoreylast year

    says invalid url but I can work with that



    there we go. "media saved successfully"



    Welp. I'm dumb. Thanks for you help!

  • discord user avatar
    denolfe
    last year

    Glad we figured it out!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.