aws / aws/aws-cdk

(s3): addEventNotifications custom resource does not allow logical ID renaming

Open
#21,036 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-s3 bug effort/medium p1
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When the custom resource handler for a bucket's object notifications is renamed, the bucket is left without notifications at all.

### Expected Behavior

Not that.

### Current Behavior

The bucket doesn't have notification handlers at all.

### Reproduction Steps

- Deploy a stack with a Bucket with Object Notifications enabled
- Rename the ID for the object notifications and redeploy
The bug is here:

https://github.com/aws/aws-cdk/blob/d644c00bc8876d15608b11bad13f62f3e3837dc2/packages/%40aws-cdk/aws-s3/lib/notifications-resource/lambda/index.py#L28

The sequence of events is as follows:

- (Create new custom resource) Put NEW object notification configuration
- (Delete old custom resource) Put EMPTY object notification configuration

End result: no notification config at all

### Possible Solution

When we fix this, don't forget to update the "important cases to handle" section in the `custom-resources` README.

### Additional Information/Context

_No response_

### CDK CLI Version

-

### Framework Version

-

### Node.js Version

-

### OS

-

### Language

Typescript, Python, .NET, Java, Go

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with packages/@aws-cdk/aws-s3/lib/notifications-resource/lambda/index.py at the linked handler location and trace the create and delete operations for renamed custom resources. Then read the “important cases to handle” section in the custom-resources README. Done means redeploying after a logical ID rename preserves the bucket’s object notification configuration and the README reflects the handled case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.