fix: skip standalone output on Vercel (missing next-server.js.nft.json) - #207
Closed
ulifehacker wants to merge 1 commit into
Closed
fix: skip standalone output on Vercel (missing next-server.js.nft.json)#207ulifehacker wants to merge 1 commit into
ulifehacker wants to merge 1 commit into
Conversation
Vercel's Next build adapter reads .next/next-server.js.nft.json during onBuildComplete, which standalone builds do not emit, so next@16.3+ deployments crash at the packaging step. Keep the standard output on Vercel (detected via the platform-injected VERCEL=1) while Docker and self-hosted builds continue to use standalone, with the new build-time NEXT_OUTPUT_MODE variable as an explicit override. Document both variables and register them in the env governance test.
Collaborator
|
While the issue can be bypassed using the standard Thank you for the new feedback, I have already fixed this in the latest version, v2.5.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
next@16.3+fails during packaging: Vercel's build adapter reads.next/next-server.js.nft.jsoninonBuildComplete, butoutput: "standalone"builds do not emit that file, sopnpm buildcrashes withENOENT ... next-server.js.nft.json. Docker and self-hosted builds are unaffected, which is why the repo unconditionally setsoutput: "standalone".standalonefor Docker and self-hosted builds, use the standard output on Vercel (detected via the platform-injectedVERCEL=1), and allow an explicit override with the new build-timeNEXT_OUTPUT_MODEvariable.NEXT_OUTPUT_MODE(and the injectedVERCEL) in.env.exampleanddocs/environment-variables.md, and register both in the env governance test.output: 'standalone'+ adapter crashesnext build— #93684 stops emitting next-server.js.nft.json but copyTracedFiles still requires it vercel/next.js#96657.Test Plan
pnpm check:importspnpm format:checkpnpm hygiene:artifacts- the script itself crashes on Windows (new URL(...).pathnameyieldsC:\C:\...); verified manually thatpublic/contains no blocked artifacts. Can send a separate one-line fix if useful.pnpm lintpnpm typecheckpnpm test- 397/399 files pass; the 3workerSize.test.tscases fail on Windows withspawn EINVAL(Node 24 refuses.cmdshims), unrelated to this change.pnpm test:e2epnpm build- verified locally on Windows with the OpenNext dev init temporarily stubbed (workerd cannot start natively on Windows);.next/standalone/is still emitted whenVERCELis unset, so the Docker path is unchanged.pnpm build:workerpnpm worker:sizepnpm worker:dry-runpnpm audit --prod --audit-level moderateNotes
pnpm build).docs/localization-pr-guide.mdand documented intentional English fallbacks. (no localization changes)