Skip to content

fix(logger): reset keys on error in middleware #4122

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

dreamorosi
Copy link
Contributor

Summary

Changes

Please provide a summary of what's being changed

This PR fixes a regression introduced in 2.16.0 to the Logger that caused temporary keys to be not cleared correctly between requests if the handler threw an error. This bug affects only customers using the injectLambdaContext() Middy.js compatible middleware and not other methods of instrumentation.

The PR fixes the bug and adds several test cases to detect this type of regression in the future.

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: fixes #4121


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Jul 2, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Jul 2, 2025
@boring-cyborg boring-cyborg bot added logger This item relates to the Logger Utility tests PRs that add or change tests labels Jul 2, 2025
@dreamorosi dreamorosi changed the title fix(logger): reset keys on error fix(logger): reset keys on error in middleware Jul 2, 2025
Copy link

sonarqubecloud bot commented Jul 2, 2025

@dreamorosi dreamorosi merged commit e310c50 into main Jul 2, 2025
55 checks passed
@dreamorosi dreamorosi deleted the fix/logger_resetKeys_middy branch July 2, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger This item relates to the Logger Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: injectLambdaContext does not respect resetKeys when an error occurs
2 participants