Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Could not find the required '{Assemly}.deps.json'. This file should be present at the root of the deployment package

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?

like image 265
user955165 Avatar asked Sep 22 '18 00:09

user955165


2 Answers

I got this error when I renamed the lambda function. Fixed It by correcting function name in the aws-lambda-tools-defaults.json

like image 152
Chirag Avatar answered Nov 28 '22 17:11

Chirag


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.)

like image 26
EriC Avatar answered Nov 28 '22 19:11

EriC