aws-lambda-dotnet icon indicating copy to clipboard operation
aws-lambda-dotnet copied to clipboard

Support for .NET Core 2.1

Open raRaRa opened this issue 8 years ago • 45 comments

Hi,

Just curious if .NET Core 2.1 support will become available soon after it has been released, or can we expect it taking a longer time, like what happened with .NET Core 2.0? Are there any significant changes that need to be made to Lambda?

On another note, are there any plans to support .NET Core 2.1 RC1? 🤔

Thanks!

raRaRa avatar May 09 '18 11:05 raRaRa

Seems like .NET Core 2.1.2 is now out with some security update. Is it going to be difficult/time consuming process for Lambda to support the latest version of .NET Core?

raRaRa avatar Jul 10 '18 20:07 raRaRa

@raRaRa We are working on the 2.1.2 but I'm not sure of the timing when it will be in Lambda.

normj avatar Jul 10 '18 21:07 normj

I upgraded the AWS Toolkit to version 1.14.4.0, Microsoft.AspNetCore.App to 2.1.0 and Amazon.Lambda.Tools to 2.2.0

When I Publish to AWS Lambda the dialog shows the correct framework (2.1) and deploys smoothly.

However when I access the API, I get an error and the CloudWatch says:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
- Check application dependencies and target a framework version installed at:
/
- Alternatively, install the framework version '2.1.0'.
Failed to execute the Lambda function. The dotnet CLI failed to start with the provided deployment package. Please check CloudWatch logs for this Lambda function to get detailed information about this failure.: LambdaException

Am I doing something wrong?

virzak avatar Jul 10 '18 21:07 virzak

In your serverless.template file for the AWS::Serverless::Function resource did you update the Runtime property to dotnetcore2.1. Sorry we should have put that in the blog post.

normj avatar Jul 10 '18 22:07 normj

@normj That was the missing piece. Thanks!

virzak avatar Jul 10 '18 22:07 virzak

I've found that for Tiered Compilation to be enabled, it needs to be set as a AWS Function environment variable. E.g. in serverless.template:

"Environment": {
    "Variables": {
        "COMPlus_TieredCompilation" : 1
    }
}

Seems to have a noticable performance improvement on cold start.

ferugi avatar Jul 10 '18 22:07 ferugi

@ferugi Super interesting, thanks for sharing. Do you know if there are any known side effects of using tiered compilation, e.g. could it actually cause overall worse performance while the startup time becomes faster.

raRaRa avatar Jul 11 '18 09:07 raRaRa

@ferugi Any chance you can quantify the performance improvement? I didn't really notice much in my testing but I might not have had enough of a real world scenario.

normj avatar Jul 11 '18 21:07 normj

Sorry for the slow response. @normj I don't have a good real world example, but a quick test with Lambda and API Gateway gave these results (128mb memory). @raRaRa I don't know enought to give you a real answer. That said, in the test I ran it did look like there was a bit more variation in response time of subsequent calls when Tiered Compilation was enabled.

ferugi avatar Jul 19 '18 14:07 ferugi

@normj Any update on support for .NET Core 2.1.2? Thanks!

raRaRa avatar Jul 26 '18 11:07 raRaRa

No updates. We're still working on getting it out as soon as we can.

vellozzi avatar Jul 26 '18 16:07 vellozzi

[SOLVED] By deleting and recreating the instance of my app in Beanstalk and then redeploying.

Apparently Dotnet Core 2.1 is supported native on beanstalk according to the link below. But I still get the "Process Failure" message as if it isn't.

https://aws.amazon.com/about-aws/whats-new/2018/06/aws-elastic-beanstalk-supports--net-core-2-1-on-windows-server-p/

ayalbelling avatar Aug 01 '18 11:08 ayalbelling

https://blogs.msdn.microsoft.com/dotnet/2018/08/02/tiered-compilation-preview-in-net-core-2-1/

raRaRa avatar Aug 03 '18 09:08 raRaRa

Once you have updated to 2.1.2 then 2.1.0 will no longer allow dynamic changes to cshtml files. I get this error https://github.com/dotnet/core/issues/1728

This has forced us to upgrade to 2.1.2 to get back productivity. Unfortunately we can no longer deploy to Lambda so we are currently stuck.

genifycom avatar Aug 07 '18 01:08 genifycom

Also quite stuck without the latest patch. Will 2.1.1 / 2.1.2 be ready soon, or should we consider changing our architecture entirely, to self-built docker containers with Fargate/self-hosted Kubernetes?

RobertPaulson90 avatar Aug 22 '18 19:08 RobertPaulson90

We're working to get 2.1.2 released as soon as possible. You shouldn't need to change anything.

vellozzi avatar Aug 23 '18 18:08 vellozzi

In the meantime 2.1.3 is out.

Just out of curiosity, what's involved in upgrading to latest .NET major or minor version? Feels like a continuous catch-up cycle.

virzak avatar Aug 23 '18 22:08 virzak

There are a lot of steps behind the scenes to build, test, verify and deploy new runtimes into AWS Lambda.

You're totally right about the catch-up cycle thing. Improving that is one of our top priorities for AWS Lambda .NET Core support.

vellozzi avatar Aug 24 '18 00:08 vellozzi

2.1.4 is out now.

PaulDMendoza avatar Sep 12 '18 17:09 PaulDMendoza

We're working on that now instead. We'll keep you posted.

vellozzi avatar Sep 12 '18 18:09 vellozzi