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

Wrong HTTP status for timeout?

未關閉
#21 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Go
星號
1.1k
分支
118
平均合併
42 分鐘
30 天內合併 PR
2

描述

With a simple Dockerfile that always times out after 1s:

```Dockerfile
FROM public.ecr.aws/lambda/nodejs:12
RUN echo 'exports.handler = (_event, _context, cb) => { setTimeout(() => {}, 100000) }' > index.js
ENV AWS_LAMBDA_FUNCTION_TIMEOUT=1
CMD ["index.handler"]
```

Hitting the endpoint:

```
$ curl -qv http://localhost:8080/2015-03-31/functions/function/invocations -d '{}'
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> POST /2015-03-31/functions/function/invocations HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 200 OK
< Date: Tue, 19 Jan 2021 02:38:17 GMT
< Content-Length: 33
< Content-Type: text/plain; charset=utf-8
<
* Connection #0 to host localhost left intact
Task timed out after 1.00 seconds* Closing connection 0
```

Returns status code 200 and no special response headers.

I didn't find conclusive documentation on what exactly should happen, but the [screenshot](https://theburningmonk.com/wp-content/uploads/2019/05/img_5ce5e801baffb.png) on [this page](https://theburningmonk.com/2019/05/how-to-log-timed-out-lambda-invocations/) seems to suggest that a "real" lambda would return 502.

貢獻指南

開啟貢獻指南

研究方向

使用提供的Dockerfile重現逾時,並使用curl向文件中說明的呼叫端點發送POST。將模擬器的200回應和標頭與連結文章中描述的實際Lambda行為進行比較,然後確定預期的狀態和標頭;完成的標準是逾時回應與該行為一致。

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

評估

技術堆疊
aws, dockerfile, go, node.js
領域
api, backend, cloud
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

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

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