Description
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[HttpPost("/2015-03-31/functions/function/invocations")]
- When this endpoint is called though, it always immediately returns instead of waiting for the invoke to finish and relaying the response
- This endpoint also has the hard-coded function name of
function
- 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?
- It does not seem there is much/any usage of
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