question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stack cannot be removed after one errorneous attempt

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:25 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
HyperBraincommented, May 29, 2017

Understood. 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:

RetainResources.member.N For stacks in the DELETE_FAILED state, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, AWS CloudFormation deletes the stack but does not delete the retained resources. Retaining resources is useful when you cannot delete a resource, such as a non-empty S3 bucket, but you want to delete the stack. Type: Array of strings Required: No

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

1reaction
StephanPraetschcommented, May 29, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I delete an AWS CloudFormation stack that's stuck in ...
Delete a stack with a dependent object or other dependencies that can't be deleted · Open the AWS CloudFormation console. · Choose the...
Read more >
Error while removing project dependency in VS2010
When I tried to remove a dependency of a project, I am getting an error message like "The dependency was added by the...
Read more >
Everything you wanted to know about exceptions - PowerShell
When an exception is thrown, that call stack is checked in order for an exception handler to catch it. Terminating and non-terminating errors....
Read more >
Error when trying to remove a lightning component's <design ...
These are the steps I performed: 1. Remove use of the involved Lightning Component from all Lightning Page using Lightning App Builder 2....
Read more >
Stack is in state and can not be updated - Seed.run
The stack is currently being updated. You cannot make another update if one is currently in progress. You need to wait. If you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found