Skip to content

LambdaTestTool - Support for Sync Invoke Waiting #1639

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

Closed
1 of 2 tasks
huntharo opened this issue Dec 12, 2023 · 3 comments
Closed
1 of 2 tasks

LambdaTestTool - Support for Sync Invoke Waiting #1639

huntharo opened this issue Dec 12, 2023 · 3 comments
Labels
feature-request A feature should be added or improved. module/lambda-test-tool p2 This is a standard priority issue queued s Effort estimation: small

Comments

@huntharo
Copy link

Describe the feature

Make LambdaClient.InvokeAsync calls work locally.

I have written a version of this but I need some guidance on how to fit this into the overall design here and to make sure I'm not breaking an intentionally existing feature.

Use Case

Complex applications that mix LambdaClient.InvokeAsync with local actions cannot currently be tested locally with both the client application and the lambda itself attached to a debugger. There are some ways around this using a deployed proxy Lambda, but that entire approach is orthogonal to LambdaTestTool's existence.

LambdaClient.InvokeAsync should be able to test blocking / sync invocations of Lambda functions, locally.

For complex projects this is an essential part of development, debugging, and testing.

Proposed Solution

  • The test event endpoint used by the web ui is also annotated with almost the right path to allow InvokeAsync calls from clients to work
  • Add a new endpoint with annotation: [HttpPost("/2015-03-31/functions/{functionName}/invocations")]
    • Wait for a TaskCompletionSource to indicate that the response is ready
    • Relay the response or error back to the caller
  • Related, particularly if debugging or testing invokes that last longer than 1 minute:
    • Allow configurability of the request timeouts

Other Information

I'll submit a draft PR with my implementation that I've been using locally.

I'm looking for feedback on:

  • Is the existing hard-coded function route usable?
    • Is it used for async invokes only?
    • If it is used, I suppose the new route would need to detect that the invoke type is not sync and operate as the current route does
  • Guidance on usage of Action for completion callbacks
    • It does not seem there is much/any usage of Action in the tool
    • Is there an alternative preferred mechanism to use?

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS .NET SDK and/or Package version used

Built from source master branch

Targeted .NET Platform

.NET 8

Operating System and version

Mac OS X Sonoma

@huntharo huntharo added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 12, 2023
@ashishdhingra ashishdhingra added module/lambda-test-tool needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Dec 12, 2023
@ashishdhingra
Copy link
Contributor

Needs review with the team.

@ashishdhingra ashishdhingra added p2 This is a standard priority issue s Effort estimation: small queued and removed needs-review labels Dec 15, 2023
@normj
Copy link
Member

normj commented Feb 1, 2025

We are working on a new version of the test tool that does support this scenario. We just released the first early preview and admittedly our documentation is light and focused on Aspire integration. But the use case of using the SDK to invoke the Lambda function via the new test tool is supported. In fact part of the new tool is an API Gateway emulator that uses the SDK to invoke Lambda functions to the Lambda emulator side of the tool. https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Processes/ApiGatewayEmulatorProcess.cs#L159

I'm closing this PR since the focus is on our new tooling which will cover this use case.

@normj normj closed this as completed Feb 1, 2025
Copy link
Contributor

github-actions bot commented Feb 1, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. module/lambda-test-tool p2 This is a standard priority issue queued s Effort estimation: small
Projects
None yet
Development

No branches or pull requests

3 participants