Skip to content
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

POST parameters with unicode symbols are not parsed correctly #1824

Closed
1 task done
ivancoso opened this issue Sep 26, 2024 · 4 comments
Closed
1 task done

POST parameters with unicode symbols are not parsed correctly #1824

ivancoso opened this issue Sep 26, 2024 · 4 comments
Assignees
Labels
annotations bug This issue is a bug. p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member

Comments

@ivancoso
Copy link

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

  • Select this option if this issue appears to be a regression.

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

<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="3.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.3" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="1.0.0" />
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.400.12" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.301" />
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="3.7.400.12" />
<PackageReference Include="AWSXRayRecorder.Handlers.AwsSdk" Version="2.13.0" />

Targeted .NET Platform

.NET 6

Operating System and version

AWS lambda, .net 6 setup

@ivancoso ivancoso added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 26, 2024
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Sep 26, 2024
@ashishdhingra ashishdhingra added annotations needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 27, 2024
@ashishdhingra ashishdhingra self-assigned this Sep 27, 2024
@ashishdhingra ashishdhingra added the p1 This is a high priority issue label Sep 27, 2024
@normj
Copy link
Member

normj commented Sep 27, 2024

@ivancoso I have reproduced the issue and confirmed this is a regression. We will work on getting a fix out quickly.

@ashishdhingra
Copy link
Contributor

@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.

@ashishdhingra ashishdhingra removed the needs-reproduction This issue needs reproduction. label Sep 27, 2024
normj added a commit that referenced this issue Sep 27, 2024
normj added a commit that referenced this issue Sep 27, 2024
@normj
Copy link
Member

normj commented Sep 29, 2024

@ivancoso version 1.5.2 of Amazon.Lambda.Annotations has been released with the fix. Thanks for reporting the issue.

@normj normj closed this as completed Sep 29, 2024
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotations bug This issue is a bug. p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member
Projects
None yet
Development

No branches or pull requests

3 participants