Freid001
Freid001

Reputation: 2850

Serverless: The specified bucket does not exist

I stupidly removed the s3 bucket for my serverless project. When I now try and deploy or remove my application I get this error: The specified bucket does not exist How can I recreate the s3 bucket from Serverless?

Upvotes: 25

Views: 20113

Answers (4)

Fonchu.
Fonchu.

Reputation: 11

I had a similar error and here is my solution

Run the following commands in you terminal from the project root directory.

serverless remove or sls remove

serverless deploy or sls deploy

Upvotes: 0

Danilo Kobold
Danilo Kobold

Reputation: 2581

For production use this plugin

https://www.serverless.com/plugins/serverless-deployment-bucket

and set the bucket. it will create if it doesnt exist.

provider:
    name: aws
    region: us-east-1
    runtime: provided.al2
    stackName: buggy
    deploymentBucket:
        name: buggy-deploymentbucket

plugins:
  - serverless-deployment-bucket

Upvotes: 3

Time
Time

Reputation: 173

Yes the serverless works like that only. When you deleted the s3 bucket it was not deleted from the stack entry hence it was failed. We should delete Stack entry as well from it if we are deleting the S3 bucket. From error handling we can also check if bucket exists or not.

Upvotes: 4

Freid001
Freid001

Reputation: 2850

I needed to delete the stack from cloud formation, once done I was able to re-run serverless deploy successfully.

Upvotes: 50

Related Questions