-
Notifications
You must be signed in to change notification settings - Fork 491
Description
Describe the bug
Hello everyone!
I faced with the compatibility issue connected with the release of Amazon.Lambda.Logging.AspNetCore - 4.0.0.
I saw the list of changes in this PR: #2062
And one of the changes in this method:
https://github.com/aws/aws-lambda-dotnet/blob/master/Libraries/src/Amazon.Lambda.Logging.AspNetCore/LambdaILogger.cs#L87
And I see the dependency is also updated in Amazon.Lambda.Core - 2.6.0.
So, I have the following csproj for my lambda function:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
<RootNamespace>func</RootNamespace>
<AssemblyName>func</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<!-- 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 ready to run images during publishing to improvement cold starts. -->
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
<PackageReference Include="Amazon.Lambda.KinesisEvents" Version="3.0.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="4.0.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageReference Include="AWSSDK.DynamoDBv2" Version="4.0.2.2" />
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="4.0.0.13" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
For local testing I'm using AWS .NET 8.0 Mock Lambda Test Tool (0.16.2).
The build artifact was validated, and assemblies for both Amazon.Lambda.Logging.AspNetCore and Amazon.Lambda.Core have latest versions, and have mentioned changes.
But once I'm trying to run Lambda locally, I receive the following error:
System.MissingMethodException: Method not found: 'Void Amazon.Lambda.Core.LambdaLogger.Log(Amazon.Lambda.Core.LogLevel, System.String, System.Object[])'.
at Microsoft.Extensions.Logging.LambdaILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func
3 formatter)
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
My AWS Lambda works fine locally including logging with Amazon.Lambda.Logging.AspNetCore 4.0.0.
Current Behavior
Once I'm trying to run Lambda locally, I receive the following error:
System.MissingMethodException: Method not found: 'Void Amazon.Lambda.Core.LambdaLogger.Log(Amazon.Lambda.Core.LogLevel, System.String, System.Object[])'.
at Microsoft.Extensions.Logging.LambdaILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func3 formatter) at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func
3 formatter)
Reproduction Steps
- Create a lambda with csproj in description.
- Run Lambda locally.
Possible Solution
No response
Additional Information/Context
Once I install Amazon.Lambda.Logging.AspNetCore 3.1.1, everything works fine. I have no chance to upload build to AWS, but tried both Debud/Release build modes.
AWS .NET SDK and/or Package version used
Amazon.Lambda.Logging.AspNetCore - 4.0.0.
Amazon.Lambda.Core - 2.6.0
Targeted .NET Platform
.NET 8
Operating System and version
Windows 11 (local runtime)