Skip to content

LambdaTestTool - Support for Sync Invoke Waiting #1639

Closed
@huntharo

Description

@huntharo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.module/lambda-test-toolp2This is a standard priority issuequeuedsEffort estimation: small

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions