-
Notifications
You must be signed in to change notification settings - Fork 479
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
LAMBDA_NET_SERIALIZER_DEBUG=true splits payloads over multiple lines #1705
Comments
@martincostello Good morning. Please let me know your kind of deployment, is it container based? Kindly refer to #1265 (comment), it might be related. Thanks, |
No it is not a container, it is an Amazon Linux 2023 custom runtime, inside which there is a .NET 8 AoT application. |
Reproducible with project created using Visual Studio AWS custom runtime template and sending JSON payload. Deployed with
CCing @normj for any inputs. |
This is a limitation of the We hope to get .NET onboarded with Lambda's structured logging support soon. That would allow you to capture all of the log messages as a single line JSON and remove the issue of stdout line breaks causing issues. |
I'm going to close this issue because Lambda has no plans for adding the telemetry API for the |
Comments on closed issues are hard for our team to see. |
Describe the bug
When
LAMBDA_NET_SERIALIZER_DEBUG=true
is set as an environment variable to try and debug JSON (de)serialization issues, if the JSON contains newlines it is split over multiple CloudWatch log messages, making it difficult to actually consume/understand the output.Expected Behavior
The JSON payload is contained in a single CloudWatch log entry.
Current Behavior
The JSON payload is split across in multiple CloudWatch log entries.
Reproduction Steps
Enable
LAMBDA_NET_SERIALIZER_DEBUG=true
and have a Lambda function process a JSON payload that contains new lines, for example:Possible Solution
For
net6.0
and later,string.ReplaceLineEndings()
could be used to transform the string before writing the payload to the console:aws-lambda-dotnet/Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/AbstractLambdaJsonSerializer.cs
Lines 60 to 61 in 28cb636
For example:
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.Serialization.SystemTextJson 2.4.1
Targeted .NET Platform
.NET 8
Operating System and version
Amazon Linux 2023
The text was updated successfully, but these errors were encountered: