Closed ivancoso closed 2 months ago
@ivancoso I have reproduced the issue and confirmed this is a regression. We will work on getting a fix out quickly.
@ivancoso I have reproduced the issue and confirmed this is a regression. We will work on getting a fix out quickly.
@normj Thanks for quick reproduction.
@ivancoso version 1.5.2 of Amazon.Lambda.Annotations has been released with the fix. Thanks for reporting the issue.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
We recently updated the version of Amazon.Lambda.Annotations nuget package from 1.0.0 to 1.5.0 and experiencing the following issue: when we call a POST request with unicode symbols in it's body, there is wrong parsing of unicode symbols for parameters marked with [FromBody] attribute (those symbols are parsed as question marks).
Regression Issue
Expected Behavior
Unicode symbols parsed correctly for POST parameters, like it was in version 1.0.0
Current Behavior
Assuming the POST body is {"title": "にちは世界"}, we expect that dto.Title property would be set to 'にちは世界' but instead it's set to '?????' :
// POST body : {"title": "にちは世界"}
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Post, "/")]
public async Task Create(APIGatewayHttpApiV2ProxyRequest request, [FromBody] CreateDto dto)
{
_logger.LogInformation(dto.Title); // output: '?????'
_logger.LogInformation(request.Body); // output: '{"title": "にちは世界"}'
}
Reproduction Steps
// POST body : {"title": "にちは世界"}
[LambdaFunction()]
[HttpApi(LambdaHttpMethod.Post, "/")]
public async Task Create(APIGatewayHttpApiV2ProxyRequest request, [FromBody] CreateDto dto)
{
_logger.LogInformation(dto.Title); // output: '?????'
_logger.LogInformation(request.Body); // output: '{"title": "にちは世界"}'
}
Possible Solution
revert to versin 1.0.0 or investigate and probably update the lib code to perform UTF-8 encoding instead of ASCII
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Targeted .NET Platform
.NET 6
Operating System and version
AWS lambda, .net 6 setup