Diagnostic step 1
Enforce a maximum request size at the ingress or reverse proxy (e.g., nginx client_max_body_size or API gateway limits) to reject overly large requests gracefully. This is reversible and low-risk.
Generated Oct 16, 2026, 9:43:08 AM
Enforce a maximum request size at the ingress or reverse proxy (e.g., nginx client_max_body_size or API gateway limits) to reject overly large requests gracefully. This is reversible and low-risk.
Replace body-parser usage for large endpoints with a streaming JSON parser (e.g., JSONStream, stream-json) that processes the request body chunk-by-chunk and avoids buffering the entire payload in memory.
Implement an upload-to-storage pattern: require clients to upload large JSON blobs to object storage (presigned URL), then send a small reference to the API to process asynchronously. This avoids large synchronous processing and is safer for reliability.
Add application-level request size limits in Express (limit option) and return a 413 error for too-large payloads while you roll out streaming or staged uploads.
Enable diagnostic logging for GC and heap usage (node --trace-gc, heapdump on OOM) and add resource alerts; if OOM persists after changes, collect heapdumps and escalate to SRE with heap profiles for deeper analysis.