-
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
TypeError exception raised when tracing is capturing request/response payloads #464
Comments
Thanks for this report @gavllew, that's super helpful. We'll take a look! |
Pending Layer Release |
Thank you for the quick response! I'm not convinced that #465 will fully bulletproof the code though. It has handled the case of For more context: our Lambda is using Middy middleware to do initial processing of the event before the (simplified) handler is invoked, and the middleware often extends/enhances/mutates the original event object. Unless the DataDog wrapper makes a clone of the original event object, it may be trying to capture the final, mutated event, which could contain both undefined values and functions. |
Thanks @joeyzhao2018! |
The v105 version layer should fix this issue |
Expected Behavior
A Lambda invocation succeeds, and a trace is sent off to DataDog.
Actual Behavior
The DataDog tracing is throwing an exception after our function code completes successfully, causing the Lambda invocation to fail.
Steps to Reproduce the Problem
serverless-plugin-datadog
to send traces/logs to DataDog.captureLambdaPayload: true
as per docsWe saw the issue when we updated to
serverless-plugin-datadog
v5.55.0; reverting to v5.49.0 (which we were running previously) fixed it again.Specifications
Stacktrace
From my own digging this looks related to PR #430, where the following code appeared:
The MDN docs for
JSON.stringify
include this note:I suspect we've been unlucky, and one of our request/response payloads may have an unexpected value at the depth cutoff of 10, leading to a
substring
method call onundefined
.The text was updated successfully, but these errors were encountered: