Skip to content

Doubled response when using Amazon.Lambda.AspNetCoreServer.Hosting with .Net 6 Minimal API with custom endpoints extension #1108

@heyjoey

Description

@heyjoey

Description

When following the description to create a Minimal API with Amazon.Lambda.AspNetCoreServer.Hosting and added FastEndpoints, the response Dto is sent twice.

Reproduction Steps

Program.cs attached, created using serverless.AspNetCoreWebAPI project template and add a nuget package called FastEndpoints. Build and Publish to Lambda in Visual Studios 2022. Post payload as:

curl --location --request POST 'https://xxxxx.execute-api.ap-northeast-1.amazonaws.com/Prod/api/author' \
--header 'Content-Type: application/json' \
--data-raw '{
    "firstName": "John",
    "lastName": "Doe",
    "age": 16
}'

Response returned:

{
    "fullName": "John Doe",
    "isOver18": false
}{
    "fullName": "John Doe",
    "isOver18": false
}

Logs

screenshot attached.

Environment

  • Build Version:
  • OS Info: Local Dev: Windows 10 | Lambda runtime: dotnet6 on AmazonLinux 2
  • Build Environment: Visual Studio Community 2022
  • Targeted .NET Platform: net6.0 (6.0.200)

Resolution

  • 👋 I can/would-like-to implement a fix for this problem myself

It seems that Amazon.Lambda.AspNetCoreServer did not set the HasStarted property of the IHttpResponseFeature which the HttpContext reads from.


This is a 🐛 bug-report
Program.cs.txt
Screen Shot 2022-03-09 at 3 04 15 PM

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions