I've created a new .NET 5 AWS Lambda Function using Container Images via the Visual Studio Project Template:
And now I want to deploy the Lambda Function and an ApiGateway using the CDK.
I was able to get it deployed, but when I invoke the method, I get this error:
❯ iwr https://3l0xxxxxx.execute-api.us-west-2.amazonaws.com/prod/
Invoke-WebRequest: {"message": "Internal server error"}
This is what I have in my Stack:
public class Dotnet5LambdaStack : Stack
{
internal Dotnet5LambdaStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
var dotnet5Lambda = new Amazon.CDK.AWS.Lambda.Function(this, "dotnet5Lambda", new FunctionProps
{
Runtime = Runtime.FROM_IMAGE,
// relative to the cdk.json file
Code = Code.FromAssetImage("src/lambdaNet5"),
Handler = Handler.FROM_IMAGE
});
new LambdaRestApi(this, "dotnet5ApiEndpoint", new LambdaRestApiProps
{
Handler = dotnet5Lambda
});
}
}
How do I fix my CDK Stack code so my Lambda + Api Gateway deploy correctly?

FunctionProps.Handlerdirectly.