Serverless: The specified bucket does not exist
Asked Answered
G

4

25

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?

Guffaw answered 25/7, 2017 at 12:19 Comment(0)
G
50

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

Guffaw answered 25/7, 2017 at 13:35 Comment(2)
Have you tried adding the bucket again? I think it might not be added in the cloud formation.Peachy
Deleting a production stack is not an option for some. So to recover the old bucket, go to the CloudFormation console for the stack in question, click the Resources tab, your bucket should be listed there somewhere. Just re-create it from the S3 console.Imhoff
S
4

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.

Storybook answered 20/8, 2017 at 18:8 Comment(0)
R
3

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
Raze answered 30/7, 2021 at 19:56 Comment(0)
C
0

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

Charge answered 22/5, 2023 at 9:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.