From 051f4674061a7d326882aecf1c692b42714a4ce9 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Thu, 20 Aug 2026 15:13:49 +0200 Subject: [PATCH] fix(build): give the Vercel type-check worker a 6 GB heap so next build stops stalling at the 45-min cap (#1749) Four production builds since 2026-08-14 (dpl_Cw4smfRf, dpl_2RPDg4vZ, dpl_DixYhSW4, dpl_9ECLphY4) and PR #1746's preview died with BUILD_EXCEEDED_MAXIMUM_TIME. Every log stops at the same line right after a normal ~92 s compile: "Running TypeScript ...", then nothing for 44 minutes. The type-check runs in a Next worker that loads the whole tsconfig program (3,500 files incl. 1,371 tests). Measured locally it needs ~4.5 GB; on the standard 4-core/8 GB Vercel machine the worker runs at V8's default ~4 GB heap ceiling, so it sits at the edge and sometimes thrashes in GC forever instead of failing. Normal builds show it too: the TS phase is 105 s most of the time and 2.3-2.4 min on the unlucky ones. CI hit the same wall on 2026-08-19 and got NODE_OPTIONS=--max-old-space-size=8192 in core-build.yml; Vercel never got the equivalent. vercel.json buildCommand now runs the same npm run build under NODE_OPTIONS=--max-old-space-size=6144. The worker inherits it (Next creates it with isolatedMemory: false). buildCommand rather than a project env var (would also reach function runtime) or build.env (deprecated in the schema). Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 --- DECISIONS.md | 1 + vercel.json | 1 + 2 files changed, 2 insertions(+) diff --git a/DECISIONS.md b/DECISIONS.md index 865e3bda..7325b475 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -1117,3 +1117,4 @@ One line per decision: `[YYYY-MM-DD] : `. Appended by agents and [2026-08-20] Reconciliation opens on the FULL year and keeps its own range-preset memory, separate from the shared report-family key. Inheriting a "Denna manad" preset last used on Resultatrapport would show an alarming difference for a window the user never chose on this page, and a part-year reconciliation window answers a question nobody asked. [2026-08-20] The matcher now runs automatically once per window+account when there is unmatched work, instead of waiting for a button many users never found. It is a dry run: nothing is written, and Tillampa still requires an explicit click. ?autorun=1 keeps a distinct meaning (run even on a clean window) so the transactions-inbox deep link still produces a result rather than silence. [2026-08-20] Unmatched bank rows that no voucher on the account could settle (direction-compatible and equal to the ore) get "Bokfor" linking to /transactions?highlight= instead of a match picker. They are unbooked affarshandelser, not reconciliation work, and the picker held nothing for them. The rule is deliberately strict: a false negative offers booking on a pairable row (a legitimate outcome), a false positive sends the user into an empty picker. +[2026-08-20] Vercel build heap is raised through vercel.json `buildCommand` (`NODE_OPTIONS=--max-old-space-size=6144 npm run build`), not a project env var and not `build.env`: a project-level NODE_OPTIONS also reaches function runtime (V8 sizes the heap against a limit the function does not have), and `build.env` is marked deprecated in the vercel.json schema; `buildCommand` scopes the flag to the build exactly like core-build.yml's 8192 does for CI. 6144 fits the standard 4-core/8 GB build machine next to the main next process; the type-check needs ~4.5 GB and was hanging at V8's ~4 GB default ceiling (4 production timeouts 2026-08-14..20). diff --git a/vercel.json b/vercel.json index 8007bde5..48627803 100644 --- a/vercel.json +++ b/vercel.json @@ -1,4 +1,5 @@ { + "buildCommand": "NODE_OPTIONS=--max-old-space-size=6144 npm run build", "regions": ["arn1"], "crons": [ {