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

LambdaBootstrapBuilder documentation is wrong / misleading #1830

Closed
tmitchel2 opened this issue Oct 2, 2024 · 4 comments
Closed

LambdaBootstrapBuilder documentation is wrong / misleading #1830

tmitchel2 opened this issue Oct 2, 2024 · 4 comments
Assignees
Labels
bug This issue is a bug. documentation This is a problem with documentation. module/lambda-client-lib p2 This is a standard priority issue

Comments

@tmitchel2
Copy link

Describe the issue

https://docs.aws.amazon.com/lambda/latest/dg/csharp-handler.html has a section which has the following

await LambdaBootstrapBuilder.Create<APIGatewayProxyRequest>(Handler, new DefaultLambdaJsonSerializer())
    .Build()
    .RunAsync();

This is incorrect because the handler will be treated as not having a response type (will just be treated as Task) and the response will not serialized back to the api gateway. This then leads to a malformed response exception which is incredibly hard to diagnose. TBH the code allows for this behaviour a bit too readily.

Anyway the documentation should include the response type as a generic to work correctly...

await LambdaBootstrapBuilder.Create<APIGatewayProxyRequest, APIGatewayProxyResponse>(Handler, new DefaultLambdaJsonSerializer())
    .Build()
    .RunAsync();

Links

https://docs.aws.amazon.com/lambda/latest/dg/csharp-handler.html

@tmitchel2 tmitchel2 added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Oct 2, 2024
@bhoradc bhoradc added p2 This is a standard priority issue needs-investigation and removed needs-triage This issue or PR still needs to be triaged. labels Oct 2, 2024
@bhoradc
Copy link

bhoradc commented Oct 2, 2024

Hi @tmitchel2,

Thank you for submitting the issue. We'll verify the proposed documentation changes and forward the request to the service team accordingly.

Regards,
Chaitanya

@ashishdhingra ashishdhingra transferred this issue from aws/aws-sdk-net Oct 2, 2024
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Nov 13, 2024

@tmitchel2 I think you are correct that example at Executable assembly handlers is missing the response return type at the below code:

await LambdaBootstrapBuilder.Create<APIGatewayProxyRequest>(Handler, new DefaultLambdaJsonSerializer())
    .Build()
    .RunAsync();

It should be updated to below code as you suggested:

await LambdaBootstrapBuilder.Create<APIGatewayProxyRequest, ILambdaContext, APIGatewayProxyResponse>(Handler, new DefaultLambdaJsonSerializer())
    .Build()
    .RunAsync();

@ashishdhingra ashishdhingra added bug This issue is a bug. needs-review and removed needs-investigation labels Nov 13, 2024
@ashishdhingra
Copy link
Contributor

@tmitchel2 I have submitted the feedback request on the documentation page Executable assembly handlers so that it goes to the correct team to update the documentation pages. Closing this issue since the request is submitted to the correct team.

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
bug This issue is a bug. documentation This is a problem with documentation. module/lambda-client-lib p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants