gatsby-plugin-s3
gatsby-plugin-s3 copied to clipboard
bucketName should not be required in gatsby-config
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?
I'm encountering the same thing. My bucket name is configured based on environment and would also benefit from it not being required
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?
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"