gatsby-plugin-s3 icon indicating copy to clipboard operation
gatsby-plugin-s3 copied to clipboard

bucketName should not be required in gatsby-config

Open andrewagain opened this issue 6 years ago • 3 comments

In my CI I actually do a gatsby build and then deploy the site to two separate buckets, so I do:

gatsby build
gatsby-plugin-s3 --bucket "bucket1"
gatsby-plugin-s3 --bucket "bucket2"

Since I know that I'm going to be specifying the bucket name on the command-line, I would rather not put it in gatsby-config.js. But when I try to start gatsby develop without it, I get:

      "bucketName" is a required option for gatsby-plugin-s3
      See docs here - https://github.com/jariz/gatsby-plugin-s3

Is there a reason why bucketName needs to be in gatsby-config.js? It is not used until deployment, right?

andrewagain avatar Sep 18 '19 17:09 andrewagain

I'm encountering the same thing. My bucket name is configured based on environment and would also benefit from it not being required

kuoloneous avatar Jan 13 '20 23:01 kuoloneous

I'm encountering the same thing. My bucket name is configured based on environment and would also benefit from it not being required

Hi, did you ever get around this?

philraymond avatar Jan 07 '21 23:01 philraymond

My workaround is to put something random (it can be anything) as the bucket name. The --bucket option will override it. For example:

// gatsby-config.js
{
      resolve: "gatsby-plugin-s3",
      options: {
        // https://github.com/jariz/gatsby-plugin-s3/issues/107
        bucketName: "not-specified",
        ...

$(npm bin)/gatsby-plugin-s3 deploy -y --bucket="actual-bucket-name"

andrewagain avatar Jan 08 '21 00:01 andrewagain