I was having issues deploying the Lambda ASP.NET Core Minimal API template to AWS Lambda.
The related issues is aws/aws-lambda-dotnet#1512
- Clone this repo
- Install Cake
dotnet tool install --global Cake.Tool
- Run
dotnet-cake
in the root of the repo. This will create the lambda package in thelambda-publish
folder. - Open AWS console and navigate to Lambda
- Create a new function
- Select
Author from scratch
- Give it a name
- Select
.Net 6
as the runtime - Click
Create function
- Click
Edit in Runtime settings
- Change Handler to
ProfileAPI
and clickSave
- Click
Upload from
and select the zip file in thelambda-publish
folder - Click on
Test
and selectCreate new test event
- Choose
api-gateway-aws-proxy
as the event template - Click
Test
The above should recreate the error. The error is:
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/var/task/'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because '/var/task/ProfileAPI.runtimeconfig.json' did not specify a framework.
- If this should be a framework-dependent app, specify the appropriate framework in '/var/task/ProfileAPI.runtimeconfig.json'.
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/var/task/'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because '/var/task/ProfileAPI.runtimeconfig.json' did not specify a framework.
- If this should be a framework-dependent app, specify the appropriate framework in '/var/task/ProfileAPI.runtimeconfig.json'.
START RequestId: a73fb0a1-d2a0-41c2-90a4-44964414e26d Version: $LATEST
RequestId: a73fb0a1-d2a0-41c2-90a4-44964414e26d Error: Runtime exited with error: exit status 131
If you want to see how it was resolved then checkout the resolved
branch.