ASPNET Minimal API on Lambda throws an error
Closed this issue · 2 comments
Describe the bug
Can not use together with ASPNET Minimal API Lambda runtime
Expected Behavior
No error is thrown.
Current Behavior
This error is shown in logs:
fail System.NullReferenceException: Object reference not set to an instance of an object. at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.MarshallRequest(InvokeFeatures features, APIGatewayProxyRequest apiGatewayRequest, ILambdaContext lambdaContext) at Amazon.Lambda.AspNetCoreServer.AbstractAspNetCoreFunction
2.FunctionHandlerAsync(TREQUEST request, ILambdaContext lambdaContext)
at Amazon.Lambda.RuntimeSupport.HandlerWrapper.<>c__DisplayClass26_02.<<GetHandlerWrapper>b__0>d.MoveNext() --- End of stack trace from previous location --- at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.InvokeOnceAsync(CancellationToken cancellationToken)
Reproduction Steps
Simple example:
var builder = WebApplication.CreateSlimBuilder(args);
builder.Services.AddAWSLambdaHosting(LambdaEventSource.RestApi);
builder.Services.AddAWSMessageBus(b =>
{
b.AddSQSPoller(...);
b.AddMessageHandler<ExampleMessageHandler, ExampleMessage>();
b.AddLambdaMessageProcessor();
});
var app = builder.Build()
How are we supposed to use ILambdaMessaging together with aspnet minimal api runtime?
Possible Solution
No response
Additional Information/Context
No response
AWS.Messaging (or related) package versions
AWS.Messaging (0.9.1)
Targeted .NET Platform
.NET8
Operating System and version
AmazonLinux
@GunboatDiplomat Good afternoon. I'm unsure if you are using the messaging library correctly. Ideally, the Poller
should be used in applications with long running process (refer Consume messages with the AWS Message Processing Framework for .NET). AWS Messaging with Lambda ASP.NET scenario should ideally use Publisher API (refer PublisherAPI example).
CC @normj / @ashovlin for any inputs.
Thanks,
Ashish
Closing for lack of traction.