serverless: Stack cannot be removed after one errorneous attempt
This is a Bug Report
Stack cannot be removed after one errorneous attempt
For bug reports:
- What went wrong?
Tried to remove the complete stack with
serverless remove. A configured bucket was not empty. Thus the stack ended up in DELETE_FAILED. Then I emptied the bucket and re-removed. But from now on serverless keeps saying “The specified bucket does not exist” - What did you expect should have happened? Remove the complete stack after all configured buckets are emptied.
- What was the config you used?
provider:
name: aws
runtime: java8
package:
artifact: target/hello-dev.jar
functions:
hello:
handler: com.serverless.Handler
resources:
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: this-is-my-unique-bucket-5646524860
- What stacktrace or error message from your provider did you see? At first with a non-empty bucket (error is correct)
Serverless: Getting all objects in S3 bucket...
Serverless: Removing objects in S3 bucket...
Serverless: Removing Stack...
Serverless: Checking Stack removal progress...
...Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: MyBucket
- The bucket you tried to delete is not empty.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 6.9.1
Serverless Version: 1.13.2
After emptying the bucket
Serverless: Getting all objects in S3 bucket...
Serverless Error ---------------------------------------
The specified bucket does not exist
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: linux
Node Version: 6.9.1
Serverless Version: 1.13.2
For feature proposals:
-
What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us. MAYBE serverless has a bug when the current state of the stack is DELETE_FAILED.
-
If there is additional config how would it look
Similar or dependent issues:
Additional Data
- Serverless Framework Version you’re using: Node Version: 6.9.1 Serverless Version: 1.13.2
- Operating System: OS: linux
- Stack Trace:
- Provider Error messages: The specified bucket does not exist
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 25 (16 by maintainers)
Dont misinterprete. Im fine with the first error if the bucket isn’t empty. But after I emptied on my own sls should be able to remove the stack. But it does not. It keeps the opinion it’s not removable. Probably a force wouldn’t help. The state of the stack seems to be misinterpreted.
I got frustrated trying to debug a CF that was failing to delete, so I just deleted it manually. Now I have an orphaned service. Would be very nice to have a
--forceoptionUnderstood. So the DELETE_FAILED is indeed the root of the error. Just read through the AWS CF docs. There is a special note on that state for the stack deletion. So Serverless should do exactly as proposed there. I.e. if SLS detects that a stack is in the DELETE_FAILED state, it should set the bucket resource to RETAIN in RetainResources. Then the delete should succeed afterwards:
Maybe, SLS should set the bucket in RetainResources in any case. Then the delete would succeed everytime and the cleanup would be up to the user completely (IMO ok, as the deployment history might be needed).
UPDATE: Here the AWS Docs link: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_DeleteStack.html