-
Notifications
You must be signed in to change notification settings - Fork 45
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: add typecheck to lambda wrapper #533
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,9 @@ def is_legacy_lambda_step_function(event): | |
""" | ||
Check if the event is a step function that called a legacy lambda | ||
""" | ||
if not isinstance(event, dict): | ||
return False | ||
|
||
event = event.get("Payload", {}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't super related to this incident, but I think it's worth changing anyway. I'm wondering if we can exit early if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good callout 👍🏽 , will add an early exit |
||
return "Execution" in event and "StateMachine" in event and "State" in event | ||
|
||
|
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.
do we have other code that assumes that this is a dict in the wrapper flow that will trip over this problem?
also, should we look at the contents of the list if it is a list? or is that impossible for a legacy lambda step function?
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.
I dont' think we need to look through the whole list. If it's not a dict, we know right away that it's not a step function event.
As for the isinstance, we do have other checks for if the event is a dict. For example in determining trace propagation we skip altogether if it's not a dict. Best answer could even be surrounding the whole thing with a try/except.
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.
extract_trigger_tags()
which is called right afteris_legacy_lambda_step_function()
expects a dict, assuming there's moreit should be impossible for legacy lambda case
according to the issue
The customers use case might still break even with this quick fix