AWS Lambda "Runtime.ExitError ... exited before completing request" in CI
The Lambda process crashed or called process.exit() during the invocation, so the runtime never received a response. The runtime reports Runtime.ExitError and that the process exited before completing the request.
What this error means
An invoke fails with "RequestId: ... Error: Runtime exited with error: exit status 1" or "exited before completing the request (unexpected)". There is often no application stack trace, just the exit.
RequestId: 7f8e9d0a Error: Runtime exited without providing a reason
Runtime.ExitErrorCommon causes
The handler calls process.exit()
Code (or a library) calls process.exit(), killing the runtime before it returns a response.
An unhandled crash in native or async code
A segfault in a native addon, or an uncaught exception in a callback outside the promise chain, terminates the process abruptly.
How to fix it
Remove explicit process exits
- Grep the handler and its dependencies for
process.exit. - Return or resolve from the handler instead of exiting the process.
- Let the runtime manage the process lifecycle.
grep -rn "process.exit" src/Surface the real crash
Add a top-level handler for uncaught errors so the cause is logged before the process dies.
process.on('unhandledRejection', (e) => { console.error(e); });How to prevent it
- Never call process.exit() inside a Lambda handler.
- Handle promise rejections and callback errors explicitly.
- Pin native addon versions that match the Lambda runtime.