aws / aws/aws-lambda-runtime-interface-emulator

Async (Event) Function Invocation Emulation?

未关闭
#32 2 条评论 18 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Go
星标
1.1k
派生
118
平均合并
42 分钟
30 天内合并 PR
2

描述

Hello there! First off, thank you for making this emulator, it is really helpful for testing and development.

My question: is there a way to run the function invocation asynchronously? As far as I can tell, right now the HTTP request to the emulator results in a blocking call (i.e. no HTTP response until the function completes). This is helpful for testing the `RequestResponse` invocations, but causes issues with code using `Event` invocations (https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_RequestSyntax).

In other words, I would expect the follow curl command to return almost immediately even if the "lambda" started takes a few minutes to complete.

```
curl -v -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -H "X-Amz-Invocation-Type: Event" -d '{}'
```

Not having this unfortunately breaks code that relies on the `Event` (async) behavior. We can of course thread/async those calls in our code, but it breaks the emulation we were hoping for.

Am I missing something, or is this indeed currently not covered by the emulator? If not covered, would a pull request to add it be welcome?

Thanks.

贡献指南

打开贡献指南

调研方向

Start by reproducing the documented curl request against the emulator, using the X-Amz-Invocation-Type: Event header and a function that runs for several minutes. Inspect the HTTP invocation entry point and compare its behavior with RequestResponse. Done means Event returns almost immediately while the function continues, without changing synchronous behavior.

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。