Repository navigation
fix(cleanup): run pnpm scripts on Node 24.22 so next dev loads Next once - #300
Merged
Merged
Conversation
…, as CI does A failure only next dev shows can no longer fail a phase exit (#292). PhaseCheck rows take an env that every command of the row inherits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fails on Node 25.9.0, the Node on PATH here: after any pipe or socket stat, require returns the pnpm symlink path and next dev loads a second copy of Next (#292, #127). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s Next once Node before 24.21.0 stops resolving symlinks in require once the process has stat-ed a pipe or a socket (nodejs/node#65113). Through pnpm's apps/web/node_modules/next link, next dev then loaded a second copy of Next, whose request store is always empty, and route handlers failed with cookies outside a request scope. devEngines.runtime makes pnpm download the pinned Node and run every script on it, whatever node is on PATH; the verify launcher uses the same binary. Closes #292 Closes #127 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ngducn
force-pushed
the
esta/fix-292-request-scope
branch
from
October 24, 2026 10:40
ca9e72d to
32b59ac
Compare
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.
On a local
pnpm devserver, the bill's receipt picture, the report downloads and the document view sometimes answered a server error, and that failed north-star step 4 about one run in three. Mẹ never saw it: production and CI were never affected. The cause is the Node version this Mac runs, not Esta's code.One thing to know, no action needed: every
pnpmcommand now runs on Node 24.22.0, which pnpm downloads once and keeps beside the dependencies. It no longer uses the Node on PATH, which is 25.9.0 on this Mac. I recommend keeping it this way. The alternative is to install Node 24.21 or later on the Mac by hand, and the same bug comes back whenever someone runs a different Node.Why
Node before 24.21.0 (and the whole 25 line) stops resolving symlinks in
requireonce anything in the process has stat-ed a pipe or a socket. Node fixed this upstream in nodejs/node#65113. pnpm reaches Next through a symlink, so undernext deva second copy of Next loaded with its own empty request store. Every route handler loaded after that copy failed with "cookieswas called outside a request scope". Production builds were not affected, and CI already ran Node 24.22.What changed
devEngines.runtimeinpackage.jsonand.nvmrcpin Node 24.22.0. pnpm runs every script on it, and the verify launcher starts the web server with the same binary.ESTA_E2E_SERVER=build).Scope
'use server'import, but it has the same signature: a route handler, dev only, and fine on a build. Those files stay as they are.next dev.Tradeoffs
scripts/web.tswould also catch a straynode scripts/web.ts. I left it out, because pnpm and the verify launcher both use the pinned Node now.Verification
next dev, slot 3: 9 of 29 runs failed step 4 on Node 25.9.0. On Node 24.22.0, 0 of 20 failed: 10 runs with it first on PATH and 10 through the pin, with the server confirmed on v24.22.0.scripts/node-runtime.test.tsfails on 25.9.0, whererequirereturnsapps/web/node_modules/next/..., and passes through pnpm on 24.22.0.pnpm checkpasses, the receipts spec passes 5 of 5, and the phase 4 north-star row passes on a fresh production build.Details
Module.prototype._compiletracer showed that in failing runs only, the server process evaluateswork-unit-async-storage.external.jstwice. The second copy is loaded through the symlink path (middleware.js→setup-node-env.external.js→node-environment→patch-error-inspect). A seven-line script reproduces the bug outside Next: resolve once,fstatSynca pipe, resolve again.member.ts./tmp/owner-fix292/ns-rate-*.log,ns-trace*-*.log,ns-node24-*.log,ns-fixed-*.log. Tracers:/tmp/owner-fix292/probe/.🤖 Generated with Claude Code