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.

貢獻指南

開啟貢獻指南

研究方向

首先,使用 X-Amz-Invocation-Type: Event 標頭以及一個執行數分鐘的函式,針對模擬器重現文件中的 curl 請求。檢查 HTTP invocation entry point,並將其行為與 RequestResponse 進行比較。當 Event 幾乎立即返回而函式繼續執行,且不改變同步行為時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
go
領域
api, backend
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。