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

Double bucket creation #97

Open
HuEric opened this issue Jul 9, 2020 · 1 comment
Open

Double bucket creation #97

HuEric opened this issue Jul 9, 2020 · 1 comment

Comments

@HuEric
Copy link

HuEric commented Jul 9, 2020

When starting serverless, I noticed that serverless-s3-local try to create bucket two times.

Serverless: starting handler
Serverless: S3 local started ( port:5645, family: IPv4, address: 127.0.0.1 )
Serverless: creating bucket: s3-storage-dev
error: Error creating bucket. Bucket "s3-storage-dev" already exists
info: PUT /s3-storage-dev 409 12ms -
offline: Starting Offline: dev/eu-west-1.
offline: Offline [http for lambda] listening on http://localhost:3002

serverless.yml

[...]
plugins:
  - serverless-offline
  - serverless-s3-local
[...]
custom:
  serverless-offline:
    httpPort: 3006
  s3: # Local S3
    host: localhost
    port: 5645
  additionalStacks:
    s3: ${file(.cloudformation/s3.yml)}
[...]

.cloudformation/s3.yml

Resources:
  StorageBucket:
    Type: AWS::S3::Bucket
    DeletionPolicy: ${self:custom.deletionPolicy.${self:provider.stage}, self:custom.deletionPolicy.other}
    Properties:
      BucketName: s3-storage-${self:provider.stage}
      AccessControl: Private

My guess is when configuring S3rver in index.js l.221 with configureBuckets, which describes all buckets configuration, also it creates them.
Then creating them again in the run function triggers the error index.js l.232.

ar90n added a commit that referenced this issue Jul 18, 2020
Thanks for @HuEric! This commit is motivated by the issue #97.
@ar90n
Copy link
Owner

ar90n commented Jul 18, 2020

Hi @HuEric
Thanks for your contribution! I agree with what you said. I fixed this issue by referencing your comment. Please try the latest version (v0.6.3) via npm.

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

2 participants