fix(lambdaweb): report init failures as AWS does (#5960)

* fix(lambdaweb): tell why a Web Function app failed to start as AWS does

An app that exits at start with a status other than 0 now gets Runtime.ExitError, and an app that cannot find a module at import gets Runtime.ImportCodeError. A failed import writes the one ERROR event AWS writes in place of Node's stack.

* fix(lambdaweb): read the init error type from a file so any exit status keeps its meaning

* fix(lambdaweb): write the init error type where any user can

* fix(lambdaweb): clear an init error type left in the runtime image
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-10-18 21:21:28 -04:00
1 parent 9ceedde585
commit b6bc3032f1
6 files changed
+99 -6

No files matched your search

+2 -2
View File
@@ -85,7 +85,7 @@ The platform answers these cases itself, with the AWS HTML pages and `lambda-web
| 404 | `Platform.InvalidEndpoint` | The `Host` is a `lambda-web` domain Floci did not mint |
| 429 | `Platform.EndpointMaxEnvThrottle` | Every environment is full and the endpoint runs `maxEnvironments` |
| 429 | `Platform.EndpointRequestThrottle` | The requests exceed the endpoint's `rateLimit` |
| 502 | `Application.TimeoutListenError`, `Application.InitCodeError`, `Runtime.Exit` | The server did not listen within 9 seconds, threw at import, or exited at start |
| 502 | `Application.TimeoutListenError`, `Application.InitCodeError`, `Runtime.ImportCodeError`, `Runtime.Exit`, `Runtime.ExitError` | The server did not listen within 9 seconds, threw at import, could not find a module at import, or exited at start with status 0 or another status |
| 503 | `Platform.EndpointDisabled` | The endpoint's `rateLimit` is 0 |
| 503 | `Runtime.OriginRequestError` | The process died while handling the request, or tens of milliseconds before it |
| 504 | `Runtime.RequestTimeout` | No response within the revision's `timeoutSeconds` |
@@ -106,7 +106,7 @@ The platform writes the `platform.*` events of the [system log schema](https://d
| Event | When |
| --- | --- |
| `platform.initStart` | The environment starts |
| `platform.initReport` | The server listens, or fails to, with the error type of the `502` page. A server that does not listen also gets an `ERROR` event that says so, unless `applicationLogLevel` is `FATAL` |
| `platform.initReport` | The server listens, or fails to, with the error type of the `502` page. A server that does not listen or an app that fails at import also gets an `ERROR` event that says so, unless `applicationLogLevel` is `FATAL` |
| `platform.invokeStart` | Right after a successful `initReport` |
| `platform.requestComplete` | At `DEBUG`, for each request the environment took, with the status, the body bytes and the error type of a `503` or `504` page |
| `platform.invokeSummary` | Every 60 seconds from `invokeStart`, and once more when the environment ends |