Aws-lambda-dotnet: DefaultLambdaJsonSerializer with LAMBDA_NET_SERIALIZER_DEBUG doesn't dump contents of object during serialize

Created on 2 May 2020  路  2Comments  路  Source: aws/aws-lambda-dotnet

When the LAMBDA_NET_SERIALIZER_DEBUG environment variable is set, Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer doesn't actually write out the contents of the object being serialized. I looked into the issue here:
https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.Serialization.SystemTextJson/DefaultLambdaJsonSerializer.cs#L80

debugWriter (below snippet pasted from link above) never has a value set. So, debugWriter.ToString() always prints an empty string.

```C#
using (var debugWriter = new StringWriter())
using (var utf8Writer = new Utf8JsonWriter(responseStream))
{
JsonSerializer.Serialize(utf8Writer, response, SerializerOptions);

var jsonDocument = debugWriter.ToString();
Console.WriteLine($"Lambda Serialize {response.GetType().FullName}: {jsonDocument}");

var writer = new StreamWriter(responseStream);
writer.Write(jsonDocument);
writer.Flush();

}
```

bug investigating modullambda-client-lib

Most helpful comment

Version 2.0.1 of Amazon.Lambda.Serialziation.SystemTextJson is out with this fix. Thanks for reporting the issue.

All 2 comments

Thanks for reporting the issue. I'm taking a look.

Version 2.0.1 of Amazon.Lambda.Serialziation.SystemTextJson is out with this fix. Thanks for reporting the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aerendel picture Aerendel  路  5Comments

scionwest picture scionwest  路  4Comments

lehoangphan picture lehoangphan  路  4Comments

ljacobsson picture ljacobsson  路  7Comments

briancullinan picture briancullinan  路  7Comments