Repository navigation
chore(web/admin): upgrade next 14→16, clear residual vulns (#7327) - #7350
Conversation
Greptile SummaryUpgrades Next.js from 14.2.35 to 16.2.6 in
Confidence Score: 4/5Safe to merge for environments with native Node.js binaries, but deployments relying on the WASM compiler fallback will break until @next/swc-wasm-nodejs is updated to match Next 16. The route handler migrations are mechanically correct and all six files look good. The override changes are well-reasoned and the audit goal of 0 vulnerabilities is achieved. The one gap is that @next/swc-wasm-nodejs was not bumped from 14.2.33 to 16.x alongside the next upgrade — any deploy pipeline or container image that lacks a native platform binary and falls back to WASM will get a major-version compiler mismatch at build time. web/admin/package.json — the @next/swc-wasm-nodejs dependency needs to be updated to 16.x to match the new next version. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming Request] --> B[Route Handler]
B --> C{Next 15+ async params}
C --> D["await props.params"]
D --> E[verifyAdmin check]
E --> F{Auth OK?}
F -- No --> G[Return 401/403]
F -- Yes --> H[Call OMI backend API]
H --> I{Response OK?}
I -- Yes --> J[Return JSON response]
I -- No --> K[Throw + return 500]
|
Resolves the breaking-change residual from #7336 (part of #7327). npm audit: 12 → 0 (originally 23; the #7336 non-breaking pass cleared the criticals/highs, this clears the rest). - next 14.2.35 → 16.2.6 (major). Cleared the next HIGH plus the minimatch/brace-expansion chain that was pinned under next@14. Ran `@next/codemod next-async-request-api`: 6 API route handlers migrated to async `params` (Next 15+), 0 codemod errors, typechecked. - Removed the now-obsolete `fast-xml-parser: ^4.5.5` override (it was force-DOWNGRADING @google-cloud/storage's intended ^5.3.4 to a vulnerable v4); fast-xml-parser now resolves to patched 5.8.0. - Added override `@tootallnate/once ^3.0.1` — cascade-clears the 8-deep low-severity firebase-admin/@Google-Cloud transport chain (firebase-admin already at latest 13.10.0; npm's only "fix" was a bogus downgrade to [email protected]). - Scoped overrides `brace-expansion@<=1.1.12 → ^2.0.2`, `minimatch@<=3.1.3 → 9.0.7`: clear the dev-only ReDoS advisories nested under @next/eslint-plugin-next@14 (eslint ignored at build; Next 16 removed `next lint`). Version-scoped so newer instances are untouched. - eslint-config-next kept at 14.2.35 (avoids forced eslint 8→9 + plugin migration, out of scope). Targeted lockfile update (preserved main's lockfile, updated only the affected subtrees) so unrelated deps don't drift — notably stripe stays pinned at 18.4.0 (a full regen bumped it to 18.5.0, whose types broke lib/stripe.ts apiVersion; avoided). Validated: npm audit 0; `next build` (Next 16) succeeds — note web/admin has no typescript.ignoreBuildErrors, so the build is a strict TS gate and passes (codemod changes typecheck). next.config.js: removed the now-unrecognized `eslint` key (Next 16 no longer reads it; build doesn't run eslint) and added `outputFileTracingRoot: __dirname`. Without the latter, Next 16's monorepo workspace-root inference nested the standalone output under `.next/standalone/<repo-path>/web/admin/server.js`, breaking the Dockerfile's `COPY .next/standalone ./` + `CMD ["node","server.js"]`. With the fix, server.js is back at `.next/standalone/server.js`. Runtime-tested: built + ran the standalone artifact (`node server.js`, exactly as the Dockerfile) with real GCP secrets, logged in via the test account, walked all 9 dashboard routes — 200, 0 page errors. Verified no regression against an unmodified next@14 `main` baseline (identical error profile; the lone 5xx is the sandbox not resolving prod Upstash Redis, present on next@14 too).
b658a13 to
a0f6057
Compare
Live testing (runtime, not just build)Built and ran the actual deployable standalone artifact — Authenticated as a test user via the normal login flow and walked all 9 dashboard routes ( Regression isolation: ran the identical test against an unmodified next@14
The only 5xx (a Redis-backed stats endpoint) is an external datastore not reachable from the test environment — it occurs identically on next@14, so it's environmental, not a regression. Net: zero runtime regressions (next@16 marginally cleaner). Deploy bug found via this testing (the build was green and hid it): Next 16's monorepo workspace-root inference nested the standalone build under an unexpected path, so the Dockerfile's |
Resolves the breaking-change residual from #7336 (part of #7327). Branched from fresh
main; single commit.Result
npm audit: 0 (was 12 residual after #7336's non-breaking pass; 23 originally).Changes
@next/codemod next-async-request-api→ 6 API route handlers migrated to asyncparams, 0 errors, typechecked.fast-xml-parser:^4.5.5override (it force-downgraded@google-cloud/storage's^5.3.4into the vuln) → patched 5.8.0.@tootallnate/once ^3.0.1override → cascade-clears the 8-deep firebase-admin/@Google-Cloud low chain (firebase-admin already latest 13.10.0; npm's only "fix" was a bogus downgrade to 10.3.0).brace-expansion@<=1.1.12 → ^2.0.2,minimatch@<=3.1.3 → 9.0.7— dev-only ReDoS under@next/eslint-plugin-next@14.eslint-config-nextkept at 14.2.35 (avoids forced eslint 8→9 + plugin migration).next.config.js: removed the now-unrecognizedeslintkey + addedoutputFileTracingRoot: __dirname. Without it, Next 16's monorepo workspace-root inference nests the standalone build under an unexpected path, breaking the Dockerfile (COPY .next/standalone ./+CMD ["node","server.js"]) → container crash on boot. Fixed →server.jsat.next/standalone/server.js.No collateral
Targeted lockfile update (preserved main's pins) — stripe stays 18.4.0 (a full regen bumped it to 18.5.0, breaking
lib/stripe.tsapiVersion typecheck).Validation
npm audit→ 0;next build(Next 16) → success. web/admin has notypescript.ignoreBuildErrors→ strict TS gate (codemod changes typecheck).node server.js, as the Dockerfile) with a production-like configuration; authenticated as a test user; walked all 9 dashboard routes → 200, 0 page errors.mainbaseline: identical/better error profile. The only 5xx is an external datastore not reachable from the test environment (present identically on next@14) — environmental, not a regression.🤖 Generated with Claude Code