src/lib/local-api-server.ts:86-103 reads the request body and awaits the route handler with no try/catch. A client aborting mid-body, or a handler that throws, becomes an unhandled rejection and can kill the CLI process during apify login or apify actor edit-input-schema.
Also, JSON.parse accepts null and arrays, so handlers reading properties off body get a non-object.
- Wrap body read + dispatch in
try/catch → 500 on handler throw
- Reject non-object JSON with 400
- Skip writing if
res.destroyed || res.writableEnded
From the review of #1304. Part of #1305.
Generated by Claude Code
src/lib/local-api-server.ts:86-103reads the request body and awaits the route handler with notry/catch. A client aborting mid-body, or a handler that throws, becomes an unhandled rejection and can kill the CLI process duringapify loginorapify actor edit-input-schema.Also,
JSON.parseacceptsnulland arrays, so handlers reading properties offbodyget a non-object.try/catch→ 500 on handler throwres.destroyed || res.writableEndedFrom the review of #1304. Part of #1305.
Generated by Claude Code