aws-lambda-dotnet: deploy-serverless of netcoreapp2.1 fails when upgrading from netcoreapp2.0
Error message:
The runtime parameter of dotnetcore2.0 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (dotnetcore2.1) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: d64414cd-885e-11e9-8e36-17648db3e023)
I’ve previously successfully upgraded from netcoreapp2.0 to netcoreapp2.1 but I’m wondering if I’m hitting a snag now that .NET Core 2.0 is EOL:
Code updates to existing functions using .NET Core 2.0 will be disabled 30 days later on May 30, 2019.
I’m using Visual Studio and I’m running:
dotnet lambda deploy-serverless
The error message indicates that my code is dotnetcore2.0, but this is not the case.
Zipping publish folder "…\bin\Release\netcoreapp2.1\publish to …\bin\Release\netcoreapp2.1\MyAppAwsServerless.zip
aws-lambda-tools-defaults.json
"framework" : "netcoreapp2.1",
serverless.template
"framework" : "netcoreapp2.1",
Since I’ve only used Visual Studio (project template) to generate and deploy the project, I’m wondering if the auto-generated CloudFormation stack is causing the problem?
When I log into the AWS Console and inspect the stack, it looks like:
AWSTemplateFormatVersion: 2010-09-09
Description: >-
An AWS Serverless Application that uses the ASP.NET Core framework running in
Amazon Lambda.
Resources:
ProxyFunction: <snip>
...
Timeout: 30
Runtime: dotnetcore2.0
Could it be that I’m not able to update the stack, because the existing template (CloudFormation stack) has “dotnetcore2.0” in it, even though the new code is dotnetcore2.1?
FYI - I updated our other serverless lambda functions before the code update limit:
Code updates to existing functions using .NET Core 2.0 will be disabled 30 days later on May 30, 2019.
that worked fine so that’s why I’m wondering if this could be the issue.
Workaround
While writing this ticket I thought I should try to manually update my lambda (using the AWS console) with the .zip created during:
dotnet lambda deploy-serverless
Updating the Lambda manually worked fine and now I’m able to update the Lambda from the command line without errors!
Problem The tooling is unable to update from dotnetcore2.0 to dotnetcore2.1 now that 2.0 is EOL. Updates are rejected even though the application is dotnetcore2.1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
Ah, I think I understand what is happening now. When deploying new code the tool makes two Lambda service calls. First to update the code and then second to update the function’s configuration including the runtime. Since the runtime isn’t updated to .NET 6 till the second service call the call to update the function’s code fails due to the state of .NET Core 2.1 deprecation status. Let me do some research on the impact of switching the order of those 2 service calls.