I have .Net Core2.1 code that I want to deploy to AWS Lambda. I don't want to use Visual studio to publish my code to Lambda I want to publish it using .net core cli. I ran command with
dotnet publish /p:GenerateRuntimeConfigurationFiles=true
I zipped up my deployment and load it into Lambda AWS console. But when I run the lambda I get the following error:
{
"errorType": "LambdaException",
"errorMessage": "Could not find the required 'RSSFeedStartService.deps.json'. This file should be present at the root of the deployment package."
}
I can see that RSSFeedStartService.deps.json
is in the deployment package. it is part of my zipped deployment
Why does it keep complaining that it is not there?
I got this error when I renamed the lambda function. Fixed It by correcting function name in the aws-lambda-tools-defaults.json
In my case, I was zipping the package incorrectly. The actual publish directory was included in the zip, which explains the "This file should be present at the root of the deployment package" part of the error.
This is what ended up working (assuming you're on Linux/Mac):
dotnet publish -o publish
cd publish
zip -r ../publish.zip *
Then I uploaded publish.zip
with the Lambda console.
(Tip: Run unzip -l publish.zip
to see the contents of the zip. It should not include publish/
before the files.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With