Skip to content

chore(web/admin): upgrade next 14→16, clear residual vulns (#7327) - #7350

Merged
mdmohsin7 merged 1 commit into
mainfrom
rex/web-admin-next16
May 17, 2026
Merged

mdmohsin7 merged 1 commit into
mainfrom
rex/web-admin-next16

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented May 17, 2026 •

Copy link
Copy Markdown
Member

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 14.2.35 → 16.2.6 (major). @next/codemod next-async-request-api → 6 API route handlers migrated to async params, 0 errors, typechecked.
  • Removed obsolete fast-xml-parser:^4.5.5 override (it force-downgraded @google-cloud/storage's ^5.3.4 into the vuln) → patched 5.8.0.
  • @tootallnate/once ^3.0.1 override → 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).
  • Scoped 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-next kept at 14.2.35 (avoids forced eslint 8→9 + plugin migration).
  • next.config.js: removed the now-unrecognized eslint key + added outputFileTracingRoot: __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.js at .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.ts apiVersion typecheck).

Validation

  • npm audit → 0; next build (Next 16) → success. web/admin has no typescript.ignoreBuildErrors → strict TS gate (codemod changes typecheck).
  • Runtime-tested: built + ran the standalone artifact (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.
  • Regression-isolated vs an unmodified next@14 main baseline: 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

@mdmohsin7
mdmohsin7 marked this pull request as ready for review May 17, 2026 18:14
@greptile-apps

greptile-apps Bot commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Upgrades Next.js from 14.2.35 to 16.2.6 in web/admin, runs the @next/codemod next-async-request-api codemod across 6 route handlers to adopt the Next 15+ async params API, and cleans up package.json overrides to resolve all 12 remaining npm audit vulnerabilities.

  • Next 14 → 16 upgrade: next bumped in package.json and lock file; six route handler files migrated to props: { params: Promise<...> } + await props.params pattern; eslint-config-next intentionally held at 14.x to defer eslint 8→9 migration.
  • Override cleanup: fast-xml-parser override removed (was incorrectly downgrading @google-cloud/storage's dependency to a vulnerable v4); @tootallnate/once, brace-expansion@<=1.1.12, and minimatch@<=3.1.3 overrides added to clear firebase-admin and eslint-plugin ReDoS chains.
  • @next/swc-wasm-nodejs remains pinned at 14.2.33 in dependencies while next is now 16.2.6 — this WASM fallback compiler is version-incompatible and will break builds in environments without native Next.js binaries.

Confidence Score: 4/5

Safe 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

Filename Overview
web/admin/package.json next bumped 14→16, async-params overrides added, fast-xml-parser removed; @next/swc-wasm-nodejs left at mismatched 14.2.33
web/admin/app/api/omi/announcements/[id]/route.ts GET/PUT/DELETE handlers correctly migrated to Next 15+ async params pattern via codemod
web/admin/app/api/omi/apps/[app_id]/details/route.ts GET handler correctly migrated to async params pattern
web/admin/app/api/omi/apps/[app_id]/popular/route.ts PATCH handler correctly migrated to async params pattern
web/admin/app/api/omi/apps/[app_id]/review/route.ts POST handler correctly migrated to async params pattern
web/admin/app/api/omi/apps/[app_id]/update/route.ts POST handler correctly migrated to async params pattern
web/admin/app/api/organizations/[id]/route.ts PATCH handler correctly migrated to async params pattern
web/admin/package-lock.json Lock file updated for [email protected], new overrides, and removed fast-xml-parser; @next/swc-wasm-nodejs still locked at 14.2.33

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]
Loading

Comments Outside Diff (1)

  1. web/admin/package.json, line 13 (link)

    P1 The @next/swc-wasm-nodejs package is pinned to 14.2.33 in dependencies while next has been upgraded to 16.2.6. Next.js loads its WASM compiler from this package as a fallback whenever the native platform binary isn't available (e.g., certain Docker base images, WASM-only edge runtimes, or ARM/musl environments). Version 14.x is not API-compatible with the Next.js 16.x runtime — any environment relying on the WASM fallback will get a compiler mismatch and fail to build. The next build success reported in the PR was on a host with native binaries, so this branch was never exercised.

Reviews (1): Last reviewed commit: "chore(web/admin): upgrade next 14→16, cl..." | Re-trigger Greptile

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).
@mdmohsin7
mdmohsin7 force-pushed the rex/web-admin-next16 branch from b658a13 to a0f6057 Compare May 17, 2026 18:47
@mdmohsin7

mdmohsin7 commented May 17, 2026 •

Copy link
Copy Markdown
Member Author

Live testing (runtime, not just build)

Built and ran the actual deployable standalone artifact — node .next/standalone/server.js, exactly as web/admin/Dockerfile runs it (not next start) — with a production-like configuration, then drove a headless browser (Playwright).

Authenticated as a test user via the normal login flow and walked all 9 dashboard routes (/dashboard, /dashboard/{payouts,releases,reviews,settings,subscriptions,summary-apps,team}, /users) → all HTTP 200, 0 page errors.

Regression isolation: ran the identical test against an unmodified next@14 main baseline with the same configuration.

next@16 (this PR) next@14 (main)
login ✅ ✅
9 routes 200 200
page errors 0 0
5xx 1 1 — identical
console errors 6 11

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 COPY .next/standalone ./ + CMD ["node","server.js"] would crash the container on boot. Fixed in this PR via outputFileTracingRoot (server.js back at .next/standalone/server.js); re-ran the standalone artifact end-to-end to confirm. The test configuration was torn down afterward.

@mdmohsin7
mdmohsin7 merged commit 4445815 into main May 17, 2026
2 checks passed
@mdmohsin7
mdmohsin7 deleted the rex/web-admin-next16 branch May 17, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant