Closed uncledru closed 2 weeks ago
@uncledru Good afternoon. Could you please verify if this is duplicate of https://github.com/aws/aws-cdk/issues/31303?
Thanks, Ashish
@uncledru Good afternoon. Could you please verify if this is duplicate of https://github.com/aws/aws-cdk/issues/31303?
Thanks, Ashish
Yes it is. I searched before I created this issue. Not sure how I missed that. Sorry!
@uncledru Good afternoon. Could you please verify if this is duplicate of #31303? Thanks, Ashish
Yes it is. I searched before I created this issue. Not sure how I missed that. Sorry!
@uncledru No problem. Closing this one in favor of https://github.com/aws/aws-cdk/issues/31303 since the other one is already prioritized and assigned.
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.
Describe the bug
When calling
addEventNotification
on an S3 BucketWe get a failure for the S3 API indicating overlapping rules:
An error occurred (InvalidArgument) 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 After debugging my specific scenario - it turns out the order of the FilterRules passed as input to the custom resource vs what is returned by the S3.Client.get_bucket_notification_configuration don't always match.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
I expect to generate the same ID regardless of the ordering of the
FilterRules
array returned in the S3 API response and successfully put the notification configuration when these things are out of order.Current Behavior
An error occurred (InvalidArgument) 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
Since I'm short on time I am not going to reproduce an entire CDK app that exhibits this problem since it also involves some existing state. A quick way to test this in isolation is:
Possible Solution
Introduce a function
recursive_sort()
that will sort all dicts/objects in the response. In the event the response ordering does change this will ensure the hash generated will remain the same by recursively sorting all levels.Additional Information/Context
I'm not sure why/how the order doesn't match what's returned in the API. We haven't touched this code in quiet some time so something at some layer (s3 api, boto3, etc) changed that broke this.
CDK CLI Version
2.115.0 (build 58027ee)
Framework Version
No response
Node.js Version
v18.19.0
OS
macos
Language
TypeScript, Python
Language Version
TypesScript (5.5.4) | Python (3.12.3)
Other information
No response