aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.57k stars 478 forks source link

LambdaValidationException when invoking Annotation Lambda #1399

Closed vezaynk closed 1 year ago

vezaynk commented 1 year ago

Describe the bug

I am trying out the .NET Annotations Lambda Framework (Preview) and am having issues using it.

I deploy:

dotnet lambda deploy-function

And then I invoke via lambda url and get an internal error. When checking cloudwatch logs I see this:

Amazon.Lambda.RuntimeSupport.ExceptionHandling.LambdaValidationException: Could not find the specified handler assembly with the file name 'LambdaTest, Culture=neutral, PublicKeyToken=null'. The assembly should be located in the root of your uploaded .zip file.

Am I deploying it wrong?

Expected Behavior

Should return a method result

Current Behavior

Results 404

Reproduction Steps

Generate from template serverless.Annotations, deploy using dotnet lambda deploy-function.

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

Only the template

Targeted .NET Platform

Dotnet6

Operating System and version

Linux

jeastham1993 commented 1 year ago

Hey @vezaynk, if you're deploying any of the 'serverless' templates in the .NET tooling then you'll need to deploy them using:

dotnet lambda deploy-serverless

This deploys the function through CloudFormation using the contents of the serverless.template file. It's this serverless.template file that gets auto-generated by the .NET tooling.

If you wanted to deploy a different way, let's say through

dotnet lambda deploy-function

You could take the details generated automatically in the serverless.template file and pass them into the dotnet lambda deploy-function wizard. For example, to deploy the 'add' Lambda endpoint you would need a handler:

"Handler": "Serverless.Annotations::Serverless.Annotations.Functions_Add_Generated::Add",

dotnet lambda deploy-function is meant for deploying a single Lambda function though, and you wouldn't get the API endpoint in front of it.

Could you try again using dotnet lambda deploy-serverless ?

ashishdhingra commented 1 year ago

@vezaynk Thanks for opening the issue. As @jeastham1993 mentioned, please try using dotnet lambda deploy-serverless.

vezaynk commented 1 year ago

It works! Thank you!

github-actions[bot] commented 1 year ago

⚠️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.