fix(s3): handle NoSuchBucket error during notification cleanup#35388
Closed
fix(s3): handle NoSuchBucket error during notification cleanup#35388
Conversation
aws-cdk-automation
previously requested changes
Sep 1, 2025
84f4b26 to
ab96438
Compare
ab96438 to
e9f906a
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
03f0ee7 to
5834e15
Compare
aws-cdk-automation
previously requested changes
Sep 1, 2025
5834e15 to
01c9889
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
44ffa90 to
8b42f39
Compare
Fixes aws#35352 When a bucket is deleted before its notifications during stack deletion, the custom resource handler now gracefully handles NoSuchBucket errors instead of failing the entire stack deletion. Changes: - Add error handling for NoSuchBucket in Python custom resource handler - Add unit tests for RETAIN and DESTROY removal policies - Add integration test covering both scenarios
8b42f39 to
71903e0
Compare
Contributor
|
Comments on closed issues and PRs are hard for our team to see. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #35352.
Reason for this change
When deleting a CloudFormation stack containing S3 bucket notifications, if the bucket is deleted before the notification cleanup runs (due to timing or manual deletion), the custom resource fails with a
NoSuchBucketerror, causing the entire stack deletion to fail. This prevents users from properly cleaning up their stacks.Description of changes
Added error handling in the Python custom resource handler (
notifications-resource-handler/index.py) to catchClientErrorexceptions withNoSuchBucketerror code during deletion operations. When this error occurs during a DELETE request, it's treated as expected behavior rather than a failure, allowing the stack deletion to proceed normally.Describe any new or updated permissions being added
No new IAM permissions are being added. The fix only adds error handling logic to existing operations.
Description of how you validated changes
RemovalPolicy.RETAINandRemovalPolicy.DESTROYscenariosChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license