-
Notifications
You must be signed in to change notification settings - Fork 36
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: Duplicate Payload Object in Input from SFN #592
Conversation
src/trace/step-function-service.ts
Outdated
typeof event.Payload === "object" && | ||
(typeof event.Payload._datadog === "object" || this.isValidContextObject(event.Payload)) |
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.
Nit: We could make this safer by adding optional chaining, i.e.
typeof event?.Payload === "object"
.
Unless we already know for sure that event is defined, then we don't have to do this
execution_id: event.Execution.Id, | ||
state_entered_time: event.State.EnteredTime, | ||
state_name: event.State.Name, |
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.
same micro nit here, might be safer to do event?.Execution?.Id
and so on
src/trace/step-function-service.ts
Outdated
typeof context.Execution === "object" && | ||
typeof context.Execution.Id === "string" && | ||
typeof context.State === "object" && | ||
typeof context.State.EnteredTime === "string" && | ||
typeof context.State.Name === "string" | ||
); |
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.
Same micro nit. Ignore me if you know 100% these fields always exist
What does this PR do?
Adds a guard clause around the code where we unpack the
Payload
object if it exists in the Step Functions event. There's an edge case where it isn't a Legacy Lambda object but customer's data may have aPayload
in thereMotivation
Python layer already checks this, we forgot to add it for node
Testing Guidelines
Tested in staging, here's a sample trace that shows how this fixes the trace merging
Additional Notes
Types of Changes
Check all that apply