Does lambda support asp.net core 6? Does documentation need updating?
The Question
I have tried to update an asp.net core 3.1 lambda to .net 6, and unfortunately following aws' documentation the lambda fails to start, giving me 502 bad gateway.
The official docs just say to upgrade to Amazon.Lambda.* 7.0.1, and this readme: https://github.com/aws/aws-lambda-dotnet/blob/ba7a655f8c316bdd078ef8b0db6b1746c61584e3/Libraries/src/Amazon.Lambda.AspNetCoreServer/README.md states nothing for .net 6
Logs:
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
284
2022-03-08T23:20:42.762+00:00
at LambdaEntryPoint..ctor()
285
2022-03-08T23:20:42.762+00:00
at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction..ctor()
286
2022-03-08T23:20:42.762+00:00
at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction2..ctor(StartupMode startupMode) 287 2022-03-08T23:20:42.762+00:00 at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction2.Start()
288
2022-03-08T23:20:42.762+00:00
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Start(IHost host)
Environment
- Build Version: Amazon.Lambda.* 7.0.1
- OS Info: debian
- Build Environment: dotnet lambda package
- Targeted .NET Platform: .net 6 ReadyToRun
This is a :question: general question
Hi @SamuelCox,
Good morning.
Thanks for posting guidance question. Could you please refer the blog post Introducing the .NET 6 runtime for AWS Lambda which has steps on migrating to .NET 6 and see if it helps.
Thanks, Ashish
Hi, as I mentioned, that document simply says to upgrade to Amazon.Lambda.* version 7.0.1. If that's all that's expected then the problem is on my side, that's fine. But I'd again note that this https://github.com/aws/aws-lambda-dotnet/blob/ba7a655f8c316bdd078ef8b0db6b1746c61584e3/Libraries/src/Amazon.Lambda.AspNetCoreServer/README.md does not make any mention of .net 6. Would be good to get it updated.
Hi, as I mentioned, that document simply says to upgrade to Amazon.Lambda.* version 7.0.1. If that's all that's expected then the problem is on my side, that's fine. But I'd again note that this https://github.com/aws/aws-lambda-dotnet/blob/ba7a655f8c316bdd078ef8b0db6b1746c61584e3/Libraries/src/Amazon.Lambda.AspNetCoreServer/README.md does not make any mention of .net 6. Would be good to get it updated.
@SamuelCox Yes, it would be good to get https://github.com/aws/aws-lambda-dotnet/blob/ba7a655f8c316bdd078ef8b0db6b1746c61584e3/Libraries/src/Amazon.Lambda.AspNetCoreServer/README.md updated for .NET 6.
For .NET 6, this seems to be the way to set up - https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting