Fix error logging during AWS init#3943
Merged
Merged
Conversation
Contributor
Author
|
Hey @antonpirker, really sorry to ping you like this but just wondering if there is any other action required from me here. Happy to patch this in our own codebase for now, but I'd love to help out where I can to see this fixed upstream. |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #3943 +/- ##
==========================================
- Coverage 79.55% 79.54% -0.01%
==========================================
Files 140 140
Lines 15512 15515 +3
Branches 2628 2629 +1
==========================================
+ Hits 12341 12342 +1
- Misses 2335 2338 +3
+ Partials 836 835 -1
|
antonpirker
approved these changes
Feb 20, 2025
antonpirker
left a comment
Contributor
There was a problem hiding this comment.
Very cool @itsbjoern, thanks for your work!
As this is still guarded by our capture_internal_exceptions and the re-enabled test case is also happy, I think it is safe to merge this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi I noticed that the AWS integration fails to capture errors during the init phase (at least in python 3.8 and above environments).
It appears tests for this were disabled after a change in AWS' own runtime environment: #3592
I was able to hunt down a change from a few months ago where it seems like string serialisation of the json payload was disabled and instead the
post_init_erroris invoked directly with the json payloadaws/aws-lambda-python-runtime-interface-client@a37a43a#diff-4513a869520b19ae4e30058106d7c3b5ddbb79216b5e9bd922d83389fb86c603R483
This breaks and causes an error internally when trying to parse the string back into json, and the error is actually swallowed because of
with capture_internal_exceptions():.I did a bit of trialling in the test suite and it seems like python3.8 still is invoked with a string, whereas 3.9+ is invoked with JSON. But because I'm not 100% sure on the behaviour I just opted to check the arg type instead. I couldn't find any better documentation on this behaviour than the link above which just seems to be a continuous stream of updates to the main AWS python image.