Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation on running AOT lambdas in test tool #1539

Open
SamuelCox opened this issue Jun 27, 2023 · 3 comments
Open

Missing documentation on running AOT lambdas in test tool #1539

SamuelCox opened this issue Jun 27, 2023 · 3 comments
Labels
bug This issue is a bug. documentation This is a problem with documentation. module/lambda-test-tool p2 This is a standard priority issue queued

Comments

@SamuelCox
Copy link

SamuelCox commented Jun 27, 2023

Describe the issue

As far as I can tell, there is no proper documentation on how to use the lambda test tool for .net 7 AOT

{
  "Information": [
    "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
    "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
    "dotnet lambda help",
    "All the command line options for the Lambda command can be specified in this file."
  ],
  "profile": "default",
  "region": "eu-west-1",
  "configuration": "Release",
  "function-runtime": "provided.al2",
  "function-memory-size": 256,
  "function-timeout": 30,
  "function-handler": "bootstrap",
  "msbuild-parameters": "--self-contained true"
}
{
  "profiles": {
    "Mock Lambda Test Tool": {
      "commandName": "Executable",
      "commandLineArgs": "--no-ui --payload payload.json",
      "workingDirectory": ".\\bin\\$(Configuration)\\net7.0",
      "executablePath": "C:\\Users\\%USERNAME%\\.dotnet\\tools\\dotnet-lambda-test-tool-7.0.exe",
      "args": [ "--port 5050" ]

    }
  }
}

throws this error:
image

If I listen to the error message (which every amazon sample on line uses "bootstrap" as the handler for aot) then I get this
image

Would massively appreciate proper documentation on this and/or a description of what I'm doing wrong

Links

https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool/README.md

@SamuelCox SamuelCox added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Jun 27, 2023
@ashishdhingra
Copy link
Contributor

@SamuelCox Thanks for reporting the issue. Please refer to https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool/README.md#testing-executable-assemblies for testing Native AOT Lambda functions. These are compiled as executable assemblies. More information can be found in the test tool documentation available at http://localhost:5050/documentation (this is the endpoint after Test tool is launched).

Please let me know if it helps.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. module/lambda-test-tool and removed needs-triage This issue or PR still needs to be triaged. labels Jun 27, 2023
@SamuelCox
Copy link
Author

image
Still doesn't work

@ashishdhingra
Copy link
Contributor

https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool/README.md#testing-executable-assemblies

@SamuelCox Here are the updated steps working for me:

  • Install Lambda Test Tool version 7.0 using command dotnet tool install -g Amazon.Lambda.TestTool-7.0.
  • Navigate to project's root directory containing .csproj file.
  • Run dotnet lambda-test-tool-7.0 to launch Lambda Test Tool.
  • As mentioned in Lambda Test Tool 7.0 documentation at http://localhost:5050/documentation, in project's launchSettings.json, specify the environment variables either via Visual Studio Debug UI or modifying the launchSettings.json manually:
{
  "profiles": {
    "LambdaNativeAOT": {
      "commandName": "Project",
      "environmentVariables": {
        "AWS_LAMBDA_RUNTIME_API": "localhost:5050",
        "AWS_PROFILE": "default",
        "AWS_REGION": "us-east-2"
      }
    }
  }
}
  • Setup breakpoint in Lambda Function handler.
  • Debug project using Visual Studio.
  • In Lambda Test Tool's Executable Assembly page, queue the event (for project created using Native AOT Visual Studio AWS template, the handler converts input string to upper case and returns it. Hence we may pass double quoted string, e.g. "Hello World" from test tool)

Breakpoint in Visual Studio should be hit now.

I agree the Lambda Test Tool documentation needs to be elaborated or made more clear.

Thanks,
Ashish

@ashishdhingra ashishdhingra added bug This issue is a bug. needs-review p2 This is a standard priority issue and removed response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. labels Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. module/lambda-test-tool p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

2 participants