From fea1a7201d749b826ace1baaa511c4e7e6892579 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Jul 2026 14:31:51 +0000 Subject: [PATCH] fix(docs): bound docs build memory to stop Vercel OOM (exit 137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The @objectstack/docs build was killed on Vercel with exit 137 (SIGKILL / container OOM). The site statically prerenders 400+ MDX pages, and two things let the build's resident set exceed the 8 GB build container: 1. Next spawns one static-generation worker per CPU. On Vercel's high-core build container that fan-out multiplied peak RSS. Cap it with `experimental.cpus: 2`. 2. Without an explicit heap ceiling, V8 sizes its max heap from the memory it detects and defers GC — in a container that reports host memory rather than the cgroup limit, RSS grows past the container limit before GC runs, and the kernel SIGKILLs the process (137). Pin the heap with `NODE_OPTIONS=--max-old-space-size=4096` so GC keeps RSS bounded. Verified locally: the full docs build completes cleanly with peak RSS ~4.9 GB (down from an unbounded ~5.3 GB+), well under the 8 GB container. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01KjroXa16g7LyNAP3sThibY --- apps/docs/next.config.mjs | 7 +++++++ apps/docs/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs index bad353b9f2..49a29ae267 100644 --- a/apps/docs/next.config.mjs +++ b/apps/docs/next.config.mjs @@ -7,6 +7,13 @@ const withMDX = createMDX(); const config = { reactStrictMode: true, output: 'standalone', + experimental: { + // The docs site prerenders 400+ MDX pages. Next spawns one static-generation + // worker per CPU, and on Vercel's high-core build container that fan-out + // multiplied the resident set until the build was OOM-killed (exit 137). + // Cap the worker count so peak memory stays well under the container limit. + cpus: 2, + }, typescript: { ignoreBuildErrors: false, }, diff --git a/apps/docs/package.json b/apps/docs/package.json index 95e186f1ec..961a0de278 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -6,7 +6,7 @@ "license": "Apache-2.0", "scripts": { "dev": "next dev", - "build": "pnpm --filter @objectstack/spec gen:schema && pnpm --filter @objectstack/spec gen:docs && next build", + "build": "pnpm --filter @objectstack/spec gen:schema && pnpm --filter @objectstack/spec gen:docs && NODE_OPTIONS='--max-old-space-size=4096' next build", "site:start": "next start", "site:lint": "next lint", "types:check": "fumadocs-mdx && next typegen && tsc --noEmit",