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.

CleanUp custom resource fails to delete bucket due when deleting the stack

See original GitHub issue

Describe the bug I deployed the cloudformation stack successfully and used the perspective UI. When attempting to delete the stack it failed to delete the AccessLogsBucket with the following error:

The bucket you tried to delete is not empty. You must delete all versions in the bucket.

I was able to clear out the bucket and retry the deletion which succeeded.

To Reproduce Steps to reproduce the behavior:

  1. Deploy the stack.
  2. Use Perspective.
  3. Delete the stack.
  4. See error.

Expected behavior Everything is removed seamlessly when you delete the stack.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
svozzacommented, Sep 24, 2020

Hi, thank you for this this report. I think I know why this issue is happening: the accesslog bucket often has a very large amount of entries in it and we have a custom resource that attempts to clear down the bucket just before deletion. What most likely is happening is that due to S3’s eventual consistency model some of the deleted resources don’t appear as deleted to CloudFormation when it finally tries to delete the bucket immediately after the custom resource terminates. It probably makes sense for us to put a sleep or poll the bucket to see that it’s empty before terminating.

1reaction
svozzacommented, Nov 19, 2020

This turned out to be an issue with a custom resource writing to a bucket during the deletion process. A fix has been made and will be available in our 1.1.0 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CleanUp custom resource fails to delete bucket due when ...
I was able to clear out the bucket and retry the deletion which succeeded. To Reproduce Steps to reproduce the behavior: Deploy the...
Read more >
Delete Lambda-backed custom resources stuck in ... - AWS
1. Open the CloudFormation console. · 2. Choose the stack that contains your custom resource that's stuck in DELETE_FAILED status. · 3. Choose ......
Read more >
Can I force CloudFormation to delete non-empty S3 Bucket?
This way you ensure the bucket deletion does not come first because there is another resource that depends on it, hence the depending...
Read more >
How to Delete S3 Bucket Contents in CloudFormation
The custom resource will use a Lambda to delete the bucket's contents. ... ultimately the CloudFormation stack delete operation would fail.
Read more >
Create and Delete S3 Object by CFN Custom Resource | Awstut
When deleting the CloudFormation stack containing the S3 bucket, automatically delete all objects in the bucket. For more information on the ...
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