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

Wrong HTTP status for timeout?

Offen
#21 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Go
Sterne
1.1k
Forks
118
Ø Merge
42 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduziere das Timeout mithilfe der bereitgestellten Dockerfile und sende mit curl einen POST an den dokumentierten Invocation-Endpunkt. Vergleiche die 200-Antwort und die Header des Emulators mit dem im verlinkten Artikel beschriebenen Verhalten der echten Lambda-Umgebung und ermittle anschließend den erwarteten Status und die erwarteten Header; abgeschlossen bedeutet, dass Timeout-Antworten diesem Verhalten entsprechen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, dockerfile, go, node.js
Bereich
api, backend, cloud
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.