Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda ASP.NET Core Web API - Container Image does not work with .NET 7 #1416

Closed
IvanFarkas opened this issue Jan 21, 2023 · 8 comments
Closed
Labels

Comments

@IvanFarkas
Copy link

IvanFarkas commented Jan 21, 2023

Describe the bug

Lambda ASP.NET Core Web API - Container Image does not work with .NET 7

Error in log:

RequestId: b5d40869-04bc-452b-8d82-ffa4134d670c Error: fork/exec /lambda-entrypoint.sh: exec format error
Runtime.InvalidEntrypoint

The same project configured for .NET 6 works, but configured for .NET 7 does not work.
See configuration differences in Readme

Sample Project (.NET 6 - main branch)
Sample Project (.NET 7 - net7 branch)

.NET 6 configuration

global.json

"sdk": { "version": "6.0.405" }

*.csproj

<TargetFramework>net6.0</TargetFramework>

aws-lambda-tools-defaults.json

"framework": "net6.0",
"function-runtime": "dotnet6",
"function-architecture": "arm64",

Dockerfile

FROM public.ecr.aws/lambda/dotnet:6

AWS SAM Lambda Output

AWS SAM WebAPI (.NET 6.0.10, amzn.2-arm64, Arm64, Arm64) on AWS Lambda with SAM

processor	: 0
BogoMIPS	: 243.75
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

processor	: 1
BogoMIPS	: 243.75
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

.NET 7 configuration

global.json

"sdk": { "version": "7.0.102" }

*.csproj

<TargetFramework>net7.0</TargetFramework>

aws-lambda-tools-defaults.json

"framework": "net7.0",
"function-runtime": "dotnet7",
"function-architecture": "arm64",

Dockerfile

FROM public.ecr.aws/lambda/dotnet:7

AWS SAM Lambda Output

{ "message": "Internal Server Error" }

AWS Log

RequestId: b5d40869-04bc-452b-8d82-ffa4134d670c Error: fork/exec /lambda-entrypoint.sh: exec format error
Runtime.InvalidEntrypoint

Expected Behavior

It behaves as the .NET 6 configuration

Current Behavior

Report error. I suspect it does not work with amd64 Graviton CPU.

AWS SAM Lambda Output

{ "message": "Internal Server Error" }

AWS Log

RequestId: b5d40869-04bc-452b-8d82-ffa4134d670c Error: fork/exec /lambda-entrypoint.sh: exec format error
Runtime.InvalidEntrypoint

### Reproduction Steps

- Clone [serverless_image_AspNetCoreWebAPI net7 branch](https://github.com/IvanFarkas/serverless_image_AspNetCoreWebAPI/tree/net7)
- Right-mouse click on the project and select **Publish to AWS Lambda...**
- Click endpoint URL
- Witness error

### Possible Solution

_No response_

### Additional Information/Context

Function ARN: arn:aws:lambda:us-east-1:981910913386:function:serverless-image-aspnetcoreweba-AspNetCoreFunction-zg2kwBNOkjMA
Request ID: ec2224f7-8ea1-4431-80f2-a5f7ab1df2c1
Timestamp with timezone:  2023-01-21T01:08:11.647Z

This is reported this as well at AWS Support, [Case ID 11809880271](https://support.console.aws.amazon.com/support/home?region=us-east-1#/case/?displayId=11809880271&language=en).

### AWS .NET SDK and/or Package version used

.NET SDK 7.0.102
Amazon.Lambda.AspNetCoreServer 7.3.0

### Targeted .NET Platform

.NET 7 (latest)

### Operating System and version

AmazonLinux
@IvanFarkas IvanFarkas added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 21, 2023
@IvanFarkas IvanFarkas changed the title Lambda ASP.NET Core Web API - Container Image does not work with .NET 7(short issue description) Lambda ASP.NET Core Web API - Container Image does not work with .NET 7 Jan 21, 2023
@rajeshaz09
Copy link

rajeshaz09 commented Jan 22, 2023

net7 only available in AMD64.
Only LTS versions supported in ARM64 architecture .
https://docs.aws.amazon.com/lambda/latest/dg/csharp-image.html

@ashishdhingra
Copy link
Contributor

ashishdhingra commented Jan 23, 2023

Sample Project (.NET 7 - net7 branch)

@IvanFarkas Could you please confirm if changing architecture to x86_64 works? We have another open issue #1310 to track issue for arm64 support.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jan 23, 2023
@IvanFarkas
Copy link
Author

@ashishdhingra Hi Ashish,
I confirm that it does work with the x86_64 architecture.
I updated my repo with the configuration and output.

What's the ETA of the arm64 (Graviton) architecture for .NET 7 Lambda Container Image, please?

@IvanFarkas
Copy link
Author

The next question is, which configuration should I use till arm64 .NET 7 is OK?

Factors

  • Startup time
  • Run time
  • Price

@normj
Copy link
Member

normj commented Jan 26, 2023

@IvanFarkas We are blocked on ARM64 support till an upcoming change by Microsoft to .NET is released. The good news is there is good progress on Microsoft's side to get the change out. dotnet/runtime#69361 (comment)

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. label Jan 26, 2023
@ashishdhingra
Copy link
Contributor

Duplicate of #1310.

@ashishdhingra ashishdhingra closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@IvanFarkas
Copy link
Author

@normj Thx Norm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants