cdklabs / cdklabs/cdk-nextjs

Track upstream fix for Next.js 16.3.x standalone+adapter ENOENT crash before upgrading past 16.2.x

Closed
#259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
108
Forks
12
Avg merge
1h 30m
Merged PRs (30d)
7

Description

## Summary

`next build` crashes on every 16.3.x release (16.3.0–16.3.4) when a build adapter is configured together with `output: 'standalone'` — which is exactly cdk-nextjs's setup (the adapter force-sets `output: 'standalone'` and the construct requires `.next/standalone`). There's no config-level workaround.

```
Error: ENOENT: no such file or directory, open '.next/next-server.js.nft.json'
```

Repro'd locally in `examples/app-playground` when bumping the `next` catalog pin from `~16.2.11` to `^16.3.0`.

## Root cause (upstream)

- [vercel/next.js#93684](https://github.com/vercel/next.js/pull/93684) (16.3.0) made Turbopack stop emitting `next-server.js.nft.json` when an adapter is configured.
- The `output: 'standalone'` finalizer (`copyTracedFiles`) still reads that file unconditionally, with no `.catch` — writer suppressed, reader kept, so any standalone+adapter build crashes.
- Fix landed on `canary` via [vercel/next.js#97287](https://github.com/vercel/next.js/pull/97287) (merged 2026-08-14), targeted for **16.4.0**.
- It was **not** backported to the `next-16-3` release branch — confirmed by the reporter that the gate file is byte-identical between v16.3.1 and v16.3.4.
- Tracked upstream in [vercel/next.js#96646](https://github.com/vercel/next.js/issues/96646), which explicitly calls out cdk-nextjs as an affected self-hosted/AWS user.
- As of 2026-09-02, a maintainer agreed to backport the fix to `next-16-3` via [vercel/next.js#98167](https://github.com/vercel/next.js/pull/98167) (not yet merged/released).

## Current state in this repo

`examples/pnpm-workspace.yaml` pins the `next` catalog entry to `~16.2.11` (see #258) specifically to stay on the 16.2.x line and dodge this regression while still picking up the security-fixed patch version.

## Action item

Once vercel/next.js#98167 (or an equivalent backport) ships in a released 16.3.x patch — or 16.4.0 releases — re-attempt bumping the `next` catalog pin in `examples/pnpm-workspace.yaml` past 16.2.x and verify `examples/app-playground` builds cleanly with `pnpm build`.

Contributor guide

Open the contributing guide

Research direction

Wait for vercel/next.js#98167 or Next.js 16.4.0 to be released, then update the Next.js catalog pin in examples/pnpm-workspace.yaml past 16.2.x. Run pnpm build in examples/app-playground; done means the standalone build completes without the ENOENT crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.