I have a CDK solution with a stack etc and in the same solution i have created a ASP.NET minimal API Lambda project.
When I deploy using the CDK I'm getting the ERROR:
Internal Server Error
When I check the logs I can see the Error:
Error: executable assembly /var/task/lambdaMinimalApi.dll was not found..
I know what this error is, it is trying to find the Lambda function thinking its a libary, but mine is an executable. I know this as when i deploy the lambda with:
dotnet lambda deploy-function
through trial an error i found out this:
.NET Lambda projects that use C# top level statements like this project must be deployed as an executable assembly instead of a class library. To indicate to Lambda that the .NET function is an executable assembly the Lambda function handler value is set to the .NET Assembly name. This is different then deploying as a class library where the function handler string includes the assembly, type and method name.
Following this and just using the assembly name I can deploy and everything works.
But when it comes to the CDK I get the internal server error mentioned above.
My public repo is here: https://github.com/RollsChris/cdk-twitter-clone-dotnet
I think it will be a good example to add to the official examples if I can get it to work?
I have tried various forms of Code.From**, and searched the internet far and wide. Most examples are using a lambda function written in javascript but the CDK is using .NET.
Thanks