Closed carlin-q-scott closed 12 hours ago
Hi @carlin-q-scott,
Good afternoon.
I referred the Readme for Layers for .NET Core Lambda Functions which mentions that In order to create an optimized runtime package store layer you must run the publish-layer command in an Amazon Linux environment
.
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install dotnet-sdk-3.1
Amazon.Lambda.Tools
using command dotnet tool install -g Amazon.Lambda.Tools
.dotnet new -i "Amazon.Lambda.Templates::*"
dotnet new serverless.AspNetCoreWebAPI --name LambdaLayerTest
dotnet lambda publish-layer dotnetCoreApi --framework netcoreapp3.1 --layer-type runtime-package-store --s3-bucket s3bucketname --enable-package-optimization true
. This ran successfully:
Amazon Lambda Tools for .NET Core applications (5.1.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Warning: Package optimization has been enabled. Be sure to run this on an Amazon Linux environment or the optimization might not be compatbile with the Lambda runtime. Converted ASP.NET Core project file to temporary package manifest file. ... invoking 'dotnet store' for manifest /tmp/tmpUU7uDf.tmp into output directory /tmp/dotnetcoreapi-637536081777950305/dotnetcore/store ... store: Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET ... store: Copyright (C) Microsoft Corporation. All rights reserved. ... store: Determining projects to restore... ... store: Restored /tmp/tmpUU7uDf.tmp (in 377 ms). ... store: Determining projects to restore... ... store: Restored /tmp/tmpUU7uDf.tmp (in 22 ms). ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll'. ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll'. ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.AspNetCoreServer.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.AspNetCoreServer.dll'. ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll'. ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll'. ... store: Native image /tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll generated successfully. ... store: Successfully generated perfmap for native assembly '/tmp/3pveskaj.utn/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll'. ... store: Files were composed in /tmp/dotnetcoreapi-637536081777950305/dotnetcore/store/x64/netcoreapp3.1/ ... store: The list of packages stored is in /tmp/dotnetcoreapi-637536081777950305/dotnetcore/store/x64/netcoreapp3.1/artifact.xml Uploading runtime package store manifest to S3 Uploading to S3. (Bucket: s3bucketname Key: LambdaLayerTest/dotnetCoreApi-637536081777524539/artifact.xml) ... Progress: 100% Upload complete to s3://s3bucketname/LambdaLayerTest/dotnetCoreApi-637536081777524539/artifact.xml Create zip file of runtime package store directory ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/artifact.xml (deflated 58%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.apigatewayevents/2.4.0/lib/netcoreapp3.1/Amazon.Lambda.APIGatewayEvents.dll (deflated 63%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.applicationloadbalancerevents/2.1.0/lib/netcoreapp3.1/Amazon.Lambda.ApplicationLoadBalancerEvents.dll (deflated 64%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.aspnetcoreserver/5.3.1/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll (deflated 55%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.core/1.2.0/lib/netstandard2.0/Amazon.Lambda.Core.dll (deflated 60%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.logging.aspnetcore/3.1.0/lib/netstandard2.0/Amazon.Lambda.Logging.AspNetCore.dll (deflated 53%) ... zipping: adding: dotnetcore/store/x64/netcoreapp3.1/amazon.lambda.serialization.systemtextjson/2.1.0/lib/netcoreapp3.1/Amazon.Lambda.Serialization.SystemTextJson.dll (deflated 54%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.apigatewayevents/2.4.0/lib/netcoreapp3.1/Amazon.Lambda.APIGatewayEvents.ni.{a8ccaf32-88ce-414f-92f7-a0f811db973a}.map (deflated 93%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.applicationloadbalancerevents/2.1.0/lib/netcoreapp3.1/Amazon.Lambda.ApplicationLoadBalancerEvents.ni.{296f8637-444b-42ee-9acf-94a993b67a53}.map (deflated 92%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.aspnetcoreserver/5.3.1/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.ni.{557277de-3de8-4b71-bdcc-9a21429cafdb}.map (deflated 91%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.core/1.2.0/lib/netstandard2.0/Amazon.Lambda.Core.ni.{bd78cead-cf7e-4b55-8be8-4b04da99ee18}.map (deflated 71%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.logging.aspnetcore/3.1.0/lib/netstandard2.0/Amazon.Lambda.Logging.AspNetCore.ni.{f718a517-71a7-4397-a4e6-fcd14029f09b}.map (deflated 90%) ... zipping: adding: dotnetcore/store/symbols/x64/netcoreapp3.1/amazon.lambda.serialization.systemtextjson/2.1.0/lib/netcoreapp3.1/Amazon.Lambda.Serialization.SystemTextJson.ni.{be733cd1-ca7f-4b6b-8141-375d72c88599}.map (deflated 90%) Created publish archive (/tmp/dotnetCoreApi-637536081818600735.zip). Uploading layer input zip file to S3 Uploading to S3. (Bucket: s3bucketname Key: LambdaLayerTest/dotnetCoreApi-637536081777524539/packages.zip) ... Progress: 82% ... Progress: 100% Upload complete to s3://s3bucketname/LambdaLayerTest/dotnetCoreApi-637536081777524539/packages.zip Layer publish with arn arn:aws:lambda:us-east-2:139480602983:layer:dotnetCoreApi:1
I'm not sure about _AmazonLinux using docker image carlin/aws-serverless-dotnet-deploy:lambda-3.1 that is FROM amazon/aws-sam-cli-build-image-python3.8 docker image_. Please clarify. (Not sure if this would work on Amazon Linux docker image, Readme specifies using Amazon Linux environment.)
Hope this helps.
Thanks,
Ashish
Hello @ashishdhingra , which EC2 AMI did you use? I used amazon/amzn2-ami-hvm-2.0.20200617.0-x86_64-gp2
, and I got the exact same result. I did exactly what you did too, except I used my project instead of the template, but it's failing on the same package that builds for you.
[ec2-user@ip-172-31-53-55 ~]$ dotnet lambda publish-layer dotnetCoreApi --framework netcoreapp3.1 --layer-type runtime-package-store --s3-bucket dms-infrastructure --enable-package-optimization true
Amazon Lambda Tools for .NET Core applications (5.1.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Warning: Package optimization has been enabled. Be sure to run this on an Amazon Linux environment or the optimization might not be compatbile with the Lambda runtime.
Converted ASP.NET Core project file to temporary package manifest file.
... invoking 'dotnet store' for manifest /tmp/tmpaN9SWO.tmp into output directory /tmp/dotnetcoreapi-637538596484720191/dotnetcore/store
... store: Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
... store: Copyright (C) Microsoft Corporation. All rights reserved.
... store: Determining projects to restore...
... store: Restored /tmp/tmpaN9SWO.tmp (in 1.09 sec).
... store: Determining projects to restore...
... store: Determining projects to restore...
... store: Restored /tmp/tmpaN9SWO.tmp (in 76 ms).
... store: Restored /tmp/tmpaN9SWO.tmp (in 51 ms).
... store: Determining projects to restore...
... store: Restored /tmp/tmpaN9SWO.tmp (in 61 ms).
... store: Determining projects to restore...
... store: Restored /tmp/tmpaN9SWO.tmp (in 794 ms).
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll generated successfully.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll'.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll generated successfully.
... store: Error: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The system cannot find the file specified.
... store: (0x80070002)
... store: Error compiling /home/ec2-user/.nuget/packages/amazon.lambda.aspnetcoreserver/5.3.1/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll: Could
not find or load a specific file. (0x80131621)
... store: Error: compilation failed for "/home/ec2-user/.nuget/packages/amazon.lambda.aspnetcoreserver/5.3.1/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll" (0x80131621)
... store: /usr/share/dotnet/sdk/3.1.407/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(148,5): error MSB3073: The command "/tmp/wmyquwpf.2lj/Optimize/netcoreapp/crossgen -nologo -readytorun -in "/home/ec2-user/.nuget/packages/amazon.lambda.aspnetcoreserver/5.3.1/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll" -out "/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.AspNetCoreServer.dll" -jitpath "/home/ec2-user/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/3.1.13/runtimes/linux-x64/native/libclrjit.so" -platform_assemblies_paths "/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimeref:/tmp/wmyquwpf.2lj/Optimize/netcoreapp"" exited with code 33. [/tmp/tmpaN9SWO.tmp]
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll generated successfully.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll'.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.Abstractions.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.Abstractions.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.Binder.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Configuration.Binder.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.DependencyInjection.Abstractions.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.DependencyInjection.Abstractions.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Logging.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Logging.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Logging.Abstractions.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Logging.Abstractions.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Options.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Options.dll'.
... store: Native image /tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Primitives.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/wmyquwpf.2lj/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Microsoft.Extensions.Primitives.dll'.
Error executing the 'dotnet store' command
@carlin-q-scott I used the AMI ID ami-05d72852800cbf29e
in the AWS console:
As mentioned in my previous comment, I'm not sure if this would work on Amazon Linux docker image (Readme specifies using Amazon Linux environment).
@ashishdhingra That is a different AMI than I used. The ID for the one I mentioned earlier is ami-0b1e2eeb33ce3d66f. It was the top choice from the AWS SDK launch EC2 instance dialog under the Linux radio button. I'm going to try building the template to see if it's somehow my csproj file. After that, I can try the same AMI you used.
I successfully built the template on my amazonlinux EC2. So the build error is related to my csproj file. The major difference between the two projects, is mine was using the base SDK, not the Web SDK. I don't need the Web SDK because I'm not using Razor. But maybe the web SDK includes the Microsoft.AspNetCore.Http.Features package, and the base does not? I'd think it would be in both since it's not specific to Razor.
I changed the SDK type in my project to match the template, and I was able to get a little further in the build:
dotnet lambda publish-layer dotnetCoreApi --framework netcoreapp3.1 --layer-type runtime-package-store --s3-bucket dms-infrastructure --enable-package-optimization true
Amazon Lambda Tools for .NET Core applications (5.1.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Warning: Package optimization has been enabled. Be sure to run this on an Amazon Linux environment or the optimization might not be compatbile with the Lambda runtime.
Converted ASP.NET Core project file to temporary package manifest file.
... invoking 'dotnet store' for manifest /tmp/tmpbQsMrf.tmp into output directory /tmp/dotnetcoreapi-637538703934835313/dotnetcore/store
... store: Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
... store: Copyright (C) Microsoft Corporation. All rights reserved.
... store: Determining projects to restore...
... store: Restored /tmp/tmpbQsMrf.tmp (in 1.11 sec).
... store: Determining projects to restore...
... store: Determining projects to restore...
... store: Restored /tmp/tmpbQsMrf.tmp (in 61 ms).
... store: Restored /tmp/tmpbQsMrf.tmp (in 59 ms).
... store: Determining projects to restore...
... store: Determining projects to restore...
... store: Restored /tmp/tmpbQsMrf.tmp (in 132 ms).
... store: Restored /tmp/tmpbQsMrf.tmp (in 873 ms).
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.ApplicationLoadBalancerEvents.dll'.
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.APIGatewayEvents.dll'.
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.AspNetCoreServer.dll generated successfully.
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Core.dll'.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.AspNetCoreServer.dll'.
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll generated successfully.
... store: Native image /tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Logging.AspNetCore.dll'.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Amazon.Lambda.AspNetCoreServer_5.3.1/runtimopt/Amazon.Lambda.Serialization.SystemTextJson.dll'.
... store: Native image /tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.Bcl.HashCode.dll generated successfully.
... store: Native image /tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.Bcl.AsyncInterfaces.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.Bcl.HashCode.dll'.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.Bcl.AsyncInterfaces.dll'.
... store: Error: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.14.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
... store: Error compiling /home/ec2-user/.nuget/packages/microsoft.entityframeworkcore/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.dll: Could
not find or load a specific file. (0x80131621)
... store: Error: compilation failed for "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.dll" (0x80131621)
... store: /usr/share/dotnet/sdk/3.1.407/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(148,5): error MSB3073: The command "/tmp/l3ubl51k.j5d/Optimize/netcoreapp/crossgen -nologo -readytorun -in "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.dll" -out "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.EntityFrameworkCore.dll" -jitpath "/home/ec2-user/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/3.1.13/runtimes/linux-x64/native/libclrjit.so" -platform_assemblies_paths "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimeref:/tmp/l3ubl51k.j5d/Optimize/netcoreapp"" exited with code 33. [/tmp/tmpbQsMrf.tmp]
... store: Native image /tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.EntityFrameworkCore.Abstractions.dll generated successfully.
... store: Successfully generated perfmap for native assembly '/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.EntityFrameworkCore.Abstractions.dll'.
... store: Error: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.14.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
... store: Error compiling /home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.design/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Design.dll: Could not find or load a specific file. (0x80131621)
... store: Error: compilation failed for "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.design/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Design.dll" (0x80131621)
... store: /usr/share/dotnet/sdk/3.1.407/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(148,5): error MSB3073: The command "/tmp/l3ubl51k.j5d/Optimize/netcoreapp/crossgen -nologo -readytorun -in "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.design/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Design.dll" -out "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.EntityFrameworkCore.Design.dll" -jitpath "/home/ec2-user/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/3.1.13/runtimes/linux-x64/native/libclrjit.so" -platform_assemblies_paths "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimeref:/tmp/l3ubl51k.j5d/Optimize/netcoreapp"" exited with code 33. [/tmp/tmpbQsMrf.tmp]
... store: Error: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.14.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
... store: Error compiling /home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.relational/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Relational.dll: Could not find or load a specific file. (0x80131621)
... store: Error: compilation failed for "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.relational/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Relational.dll" (0x80131621)
... store: /usr/share/dotnet/sdk/3.1.407/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(148,5): error MSB3073: The command "/tmp/l3ubl51k.j5d/Optimize/netcoreapp/crossgen -nologo -readytorun -in "/home/ec2-user/.nuget/packages/microsoft.entityframeworkcore.relational/3.1.14/lib/netstandard2.0/Microsoft.EntityFrameworkCore.Relational.dll" -out "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimopt/Microsoft.EntityFrameworkCore.Relational.dll" -jitpath "/home/ec2-user/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/3.1.13/runtimes/linux-x64/native/libclrjit.so" -platform_assemblies_paths "/tmp/l3ubl51k.j5d/Microsoft.EntityFrameworkCore.Design_3.1.14/runtimeref:/tmp/l3ubl51k.j5d/Optimize/netcoreapp"" exited with code 33. [/tmp/tmpbQsMrf.tmp]
Error executing the 'dotnet store' command
So it was finally able to completely optimize the Amazon.Lambda.AspNetCoreServer_5.3.1 package, and then failed on the next one. Do all the sub-dependencies need to be included in the SDK for the store command to be able to resolve them?
Hi @carlin-q-scott,
Good afternoon.
Could you please share the .csproj
file for us to investigate further?
Thanks, Ashish
Sure, here you go:
Sure, here you go:
Hi @carlin-q-scott,
Could you please share the .csproj
file? The ZIP file that you uploaded only contains the .sln
file.
Thanks, Ashish
Oops, sorry about that. Layer.zip
While I have not been able to create an optimized layer, I believe the ReadyToRun compilation directive introduced in dotnet 3.1 makes optimized layers less important.
I can add the <PublishReadyToRun>true</PublishReadyToRun>
compiler directive to my lambda project's csproj file to get pre-jitted assemblies. That change reduced cold start time from 8 to 5 seconds.
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.
Please re-open. The issue has not been fixed to my knowledge.
@carlin-q-scott Good morning. Could you please check if this is still reproducible in .NET 6 or later? .NET 3.1 has reached end of life per https://dotnet.microsoft.com/en-us/download/dotnet/3.1. Based on discussion with the team, we could investigate the issue if it is reproducible in .NET6+.
Thanks, Ashish
This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
Description
I cannot publish-layer --enable-package-optimization if I depend on any version of Amazon.Lambda.AspNetCoreServer later than 3.1.0.
Reproduction Steps
dotnet lambda publish-layer dotnetCoreApi --framework netcoreapp3.1 --layer-type runtime-package-store --s3-bucket does-not-matter --enable-package-optimization true
Logs
... store: Error: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. ... store: (0x80070002) ... store: Error compiling /root/.nuget/packages/amazon.lambda.aspnetcoreserver/5.0.0/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll: Could not find or load a specific file. (0x80131621) ... store: Error: compilation failed for "/root/.nuget/packages/amazon.lambda.aspnetcoreserver/5.0.0/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll" (0x80131621) ... store: /var/lang/bin/sdk/3.1.407/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(148,5): error MSB3073: The command "/tmp/3j4cizrq.z40/Optimize/netcoreapp/crossgen -nologo -readytorun -in "/root/.nuget/packages/amazon.lambda.aspnetcoreserver/5.0.0/lib/netcoreapp3.1/Amazon.Lambda.AspNetCoreServer.dll" -out "/tmp/3j4cizrq.z40/Amazon.Lambda.AspNetCoreServer_5.0.0/runtimopt/Amazon.Lambda.AspNetCoreServer.dll" -jitpath "/root/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/3.1.13/runtimes/linux-x64/native/libclrjit.so" -platform_assemblies_paths "/tmp/3j4cizrq.z40/Amazon.Lambda.AspNetCoreServer_5.0.0/runtimeref:/tmp/3j4cizrq.z40/Optimize/netcoreapp"" exited with code 33. [/tmp/tmpe1W609.tmp]
Environment
Resolution
This is a :bug: bug-report