-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(s3-deployment): prevent log group deletion before Lambda execution #35643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(s3-deployment): prevent log group deletion before Lambda execution #35643
Conversation
When a custom log group is passed to BucketDeployment, the log group was not reliably deleted during stack deletion. This occurred because there was no explicit dependency between the Lambda function and the log group. During stack deletion, CloudFormation could delete the log group before the Lambda function completed execution. When the Lambda tried to write logs after the log group was deleted, AWS Lambda automatically recreated the log group, causing it to remain even after stack deletion. This change adds an explicit dependency to ensure the Lambda function is deleted before the log group, preventing the automatic recreation. Fixes aws#35632
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
Add test to ensure that when a custom log group is provided to BucketDeployment, the Lambda function handler has an explicit dependency on the log group. This prevents the log group from being deleted before the Lambda during stack deletion.
…ependency Update the integration test snapshot to reflect the new dependency between the Lambda function and the custom log group.
Extract log group to a variable to demonstrate the dependency relationship between the log group and BucketDeployment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Updated PR to pass CI linter tests. |
|
This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing To prevent automatic closure:
This PR will automatically close in 14 days if no action is taken. |
|
Hi, This PR has conflicts that need to be resolved before it can be reviewed. |
|
This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing To prevent automatic closure:
This PR will automatically close in 14 days if no action is taken. |
|
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
|
Comments on closed issues and PRs are hard for our team to see. |
Summary
Rationale
When a custom
logGroupis provided toBucketDeployment, CloudFormation may delete the log group before the Lambda function finishes executing during stack deletion. This causes AWS Lambda to automatically recreate the log group when it attempts to write logs, resulting in orphaned log groups that appear deleted in CloudFormation but still exist in AWS.Changes
handler.node.addDependency(props.logGroup)when a custom log group is providedFixes #35632