Skip to content

AWS Lambda .NET 7 AOT (Native) does not start when provisioned concurrency is used #1441

@vitalybibikov

Description

@vitalybibikov

Describe the bug

When .NET 7 AOT lamdba is being deployed to al2 runtime (Custom runtime on Amazon Linux 2)
it's impossible for it to create Provisioned concurrency as it errors with:

Custom runtime on Amazon Linux 2

'Failed FUNCTION_ERROR_INIT_FAILURE(0/10)'

In logs I can see:

image

Expected Behavior

Provisioned concurrency works as expected, function initializes and starts.

Current Behavior

image
image

Reproduction Steps

We are having this issue in production for our functions ,but it is reproducable for a simple lambda.NativeAOT template:

  1. Create new lambda project => dotnet new lambda.NativeAOT
  2. Deploy it => dotnet lambda deploy-function
  3. Create version, e.g. 1
  4. Go to AWS Console => Lamdba => Configuration => Concurrency
  5. Create Provisioned concurrency configuration
  6. Wait

Possible Solution

No response

Additional Information/Context

Project configuration:

<PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <AWSProjectType>Lambda</AWSProjectType>
    <AssemblyName>bootstrap</AssemblyName>
    <!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <!-- Generate Native AOT image during publishing to improve cold start time. -->
    <PublishAot>true</PublishAot>
    <!-- StripSymbols tells the compiler to strip debugging symbols from the final executable if we're on Linux and put them into their own file. 
    This will greatly reduce the final executable's size.-->
    <StripSymbols>true</StripSymbols>
  </PropertyGroup>

AWS .NET SDK and/or Package version used

<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.8.2" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />

Targeted .NET Platform

.NET 7

Operating System and version

AmazonLinux2 (provided.al2)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions