Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucketName property is not honored, not working #17

Open
kling-appfire opened this issue Oct 15, 2019 · 7 comments
Open

bucketName property is not honored, not working #17

kling-appfire opened this issue Oct 15, 2019 · 7 comments

Comments

@kling-appfire
Copy link

Given the following website serverless.yml the bucket is named a random system assigned GUID name regardless of if the bucketName property is there or not.
`
name: my.domain.com
stage: local

website:
component: '@serverless/website'
inputs:
code:
src: client/dist
hook: domain=my.domain.com npm run clean:build
region: us-east-1
bucketName: local.my.domain.com-specialbucketname123
env:
API_URL: https://my.domain.com
STAGE: local

domain: my.domain.com

`
Tried:

  • With/without quotes
  • deleting and re-creating buckets via S3 console
  • bucket with desired name was able to be created via console as well.
@eahefnawy
Copy link
Member

Hi @kling-appfire ... the bucketName is a recent addition from this PR #3 ... It's already published, but I'm guessing that at the time it was published, you already had a bucket deployed and saved to state, so it keeps using that (this is the expected behavior for backward compatibility).

So if you'd like to have your bucket name set, you could do a remove then deploy again with the bucketName set. I think it should work then.

If it doesn't let me know, I'll keep this issue open for ya! 😊

@kling-appfire
Copy link
Author

Got it working! Not quite sure how. There were several issue related to having a 'stale' .serverless folder. We've been switching between .env (profiles) and there are apparently some stored settings in .serverless that need to be cleared out related to bucketnames.

Replicate by running with one bucketName, then change the bucketName w/same .serverless and it will not create a new bucket.

@himasimplisafe
Copy link

himasimplisafe commented Nov 8, 2019

I am not able to set bucketName to be customized something like ${self:provider.stage}-mybucketname.

@hoang-innomize
Copy link

I am still able to setup bucketName but I noted that if we use full domain name i.e. my-app.domain.com then we will have an error relate to CloudFront distribution.

BTW, I have written this post to describe how to use the serverless component to deploy multiple stages/environments. We are using in production and have no issue so far.

@himasimplisafe
Copy link

Thank you for the post. In my case, I used serverless website component, which do not have provider as aws in serverless.yml, hence I can't use resources>Resources> Bucket etc and I am deploying using just serverless, not serverless deploy.
I used serverless.yml, not serverless.js. Maybe I need to switch to serverless.js to customize bucket for different environments.

@danielo515
Copy link

I am on a similar situation. For some reason I can not understand it allways tries to generate the same:

{
  "region": "us-east-1",
  "privateZone": false,
  "domain": "danielo.es",
  "subdomains": [
    {
      "domain": "pento.danielo.es",
      "type": "awsS3Website",
      "s3BucketName": "pento"
    }
  ]
}

Subdomain is correct, but buketName is not, domain is not...
Here is my sls file:

name: time-tracker
stage: dev

myWebsite:
  component: "@serverless/website"
  inputs:
    code:
      root: ./ 
      src: ./build 
      hook: yarn build
    region: eu-central-1 
    bucketName: pento.danielo.es 
    domain: pento.danielo.es

@theskillwithin
Copy link

I am in a similar situation I am attempting to do:

name: hv-app
service: hv-app

website:
  component: "@serverless/website"
  inputs:
    code:
      src: dist
      hook: yarn build
    region: us-east-1
    bucketName: hv-app-${opt:stage, 'dev'} ## dev or prod
    # domain: "hv-app"

storybook:
  component: "@serverless/website"
  inputs:
    code:
      src: storybook-static
      hook: yarn build-storybook
    region: us-east-1
    bucketName: hv-app-storybook-${opt:stage, 'dev'} ## dev or prod
    # domain: "hv-app-storybook"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants