-
Notifications
You must be signed in to change notification settings - Fork 620
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 exception handling for events with requestContext #2418
Fix exception handling for events with requestContext #2418
Conversation
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.
Thanks, nice catch!
Please add a CHANGELOG entry. |
Added CHANGELOG entry. |
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.
@alessandrobologna you added more changelog entries than this PR 😅
4cf1194
to
1c0fffd
Compare
@xrmx apologies, this should be fixed now |
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.
Thanks!
👋 Hey, we've just run into this issue. Is it possible a new release can be made soon that includes this fix? |
Description
For Lambda invocations with an event that contains a
requestContext
property, the current code throws anUnboundLocalError
if an exception (of other type) is thrown in the function execution, due to theresult
variable being accessed before being initialized. This PR simply makes sure that is initialized before being used.Fixes #2399
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
tox -e py38-test-instrumentation-aws-lambda
tox -e py39-test-instrumentation-aws-lambda
tox -e py310-test-instrumentation-aws-lambda
tox -e py311-test-instrumentation-aws-lambda
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.