-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Expected Behavior
Returning an error from the Lambda handler function should successfully send a corresponding trace/span to DataDog, regardless of the error message contents
Actual Behavior
If the error returned by the Lambda handler function contains illegal HTTP header characters (namely newline characters), then this library fails to send the corresponding End Invocation span to the lambda extension, as it puts the error message into an HTTP header as-is. This results in the span never being sent to DataDog
Steps to Reproduce the Problem
- Return an error from a Lambda function that contains a newline character
Specifications
- Datadog Go Lambda package version: v1.23.0
- Go version: go1.24.3
Stacktrace
(From my Lambda function logs)
2025/06/28 21:39:40 {"status":"error","message":"datadog: could not send end invocation payload to the extension: Post \"http://localhost:8124/lambda/end-invocation\": net/http: invalid header field value for \"X-Datadog-Invocation-Error-Msg\""}
I took a glance at the datadog-lambda-extension code and notice that it appears to be attempting to base64 decode this header, so I tested updating this library to base64 encode this error message and that appears to have fixed the issue - sheacloud@0d92837
Let me know if this sounds correct and if I should open up a PR for this change