Description
Describe the bug
I'm facing an issue while trying to delete the existing S3 event notifications.
The problem arises with S3 bucket event notification handler Lambda(AWS CloudFormation handler for "Custom::S3BucketNotifications" resources (@aws-cdk/aws-s3)), where it fails and reports an error: when calling the PutBucketNotificationConfiguration operation: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.
Custom event notification handler reference : https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resource-handlers/lib/aws-s3/notifications-resource-handler/index.py
The issue is likely related to the change: 37be7b9
The offending line is Line 39 - we are updating the ID of a JSON object, but the ID is inside of that object when it comes from outside. (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resource-handlers/lib/aws-s3/notifications-resource-handler/index.py#L39)
Expected Behavior
Should delete the existing event notifications
Current Behavior
Unable to delete the existing filters:
Error: when calling the PutBucketNotificationConfiguration operation: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.
Reproduction Steps
- Add few event notifications
- Remove some of the the added notifications.
Please find the example stack attached to reproduce the issue.
s3-event-notifications.txt
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.124.0
Framework Version
No response
Node.js Version
v20.11.0
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response