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

Invalid CodeUri generated by .NET Lambda Annotations Framework (Preview)

Open jaknor opened this issue 3 years ago • 0 comments

Describe the bug

If you set the template path in aws-lambda-tools-defaults.json to a different folder (for example the folder one level above the projects with the lambda code), then the CodeUri path of the lambdas in the generated template is incorrect. The result of this is that commands such as sam build fails with an error message (No .NET project found in directory)

The expected result is that

Expected Behavior

The CodeUri path should be set relative to the template.

I.E. if your lambda code exists in a folder named AwsLambdaAnnotations and you set the template path to ../template.yaml then the CodeUri in the generated template would need to be ./AwsLambdaAnnotations

Current Behavior

The CodeUri path is set incorrectly. I've tried 2 different scenarios

  • Template path set to one folder above the project with the lambda code
    • CodeUri is set to ..
  • Template path set to a folder inside the project with the lambda code
    • CodeUri is set to ../..

Reproduction Steps

https://github.com/jaknor/AwsLambdaAnnotations

Possible Solution

No response

Additional Information/Context

I mentioned this problem in the Annotations design document and was asked to create a new issue for it

AWS .NET SDK and/or Package version used

<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.4.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="0.5.0-preview" />

Targeted .NET Platform

.NET 6

Operating System and version

Windows 10

jaknor avatar Apr 28 '22 16:04 jaknor