0

Good morning. I'm trying to use the CLI to do an automated deployments to AWS lambda of my C# lambda project. With dotnet 3.1 I would do the following.

dotnet lambda deploy-serverless --configuration debug --stack-name custom-webhook-dev --s3-bucket custom-deployment-dev --template serverless.dev.template --region us-east-1 --s3-prefix custom-salesforce-integration-

This will take care of my deployment to my dev environment, while my production deployment would be similar but replacing dev with prod and debug for release.

But with 5.0 I get the following issue :

Amazon Lambda Tools for .NET Core applications (3.2.3)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Processing CloudFormation resource AspNetCoreFunction
Initiate packaging of . for resource AspNetCoreFunction
Unknown error executing command: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value)
at Amazon.Lambda.Tools.LambdaUtilities.DetermineTargetFrameworkFromLambdaRuntime(String lambdaRuntime, String projectLocation) in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Lambda.Tools\LambdaUtilities.cs:line 38
at Amazon.Lambda.Tools.TemplateProcessor.TemplateProcessorManager.PackageDotnetProjectAsync(IUpdateResourceField field, String location) in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Lambda.Tools\TemplateProcessor\TemplateProcessorManager.cs:line 223
at Amazon.Lambda.Tools.TemplateProcessor.TemplateProcessorManager.ProcessUpdatableResourceAsync(String templateDirectory, IUpdateResourceField field) in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Lambda.Tools\TemplateProcessor\TemplateProcessorManager.cs:line 167
at Amazon.Lambda.Tools.TemplateProcessor.TemplateProcessorManager.TransformTemplateAsync(String templateDirectory, String templateBody) in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Lambda.Tools\TemplateProcessor\TemplateProcessorManager.cs:line 95
at Amazon.Lambda.Tools.Commands.DeployServerlessCommand.PerformActionAsync() in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Lambda.Tools\Commands\DeployServerlessCommand.cs:line 167
at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand1.ExecuteAsync() in C:\codebuild\tmp\output\src109826539\src\src\Amazon.Common.DotNetCli.Tools\Commands\BaseCommand.cs:line 44

It seems to be missing the key for DetermineTargetFrameworkFromLambdaRuntime

What value should this be? What I'm trying to do is just automate the deployment to lambda of my project, Ideally I would like one file to deploy to dev, and 1 file to deploy to production.

One thing that it is missing is the "Runtime" setting that was in 3.1. Am I supposed to add this on this file or or the command line? And if yes, what value should it be?

The value on a 3.1 template was "Runtime": "dotnetcore3.1", Thank you in advance.

Philip Pittle
  • 11,821
  • 8
  • 59
  • 123

1 Answers1

2

AWS Lambda doesn't support .NET 5 yet. Supported versions are :

  1. .NET Core 3.1

  2. .NET Core 2.1

Lambda runtimes

.NET 5 is supported via container images

.NET 5 AWS Lambda Support with Container Images

samtoddler
  • 8,463
  • 2
  • 26
  • 21
  • The project deployed is a container image with dotnet5 that works perfectly if deployed using the wizard. The question was how to deploy via CLI. – Alejandro Gonzalez Feb 08 '21 at 13:46
  • @AlejandroGonzalez you can create/update functions via CLI as well take a look here [Makefile](https://github.com/toddlers/aws-step-function-callback/blob/main/Makefile#L55) – samtoddler Feb 08 '21 at 14:09