Unverified Commit ec28a4fd authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove `experimental.useNodeStreams` flag as it's enabled (#93938)

### What?

Remove `experimental.useNodeStreams` from the public config surface and
make Node streams always-on for Node.js App Router rendering.

The smaller default-on change and dedicated CI cleanup landed in #94311.
The standalone compatibility update landed separately in #94347.

### Why?

Node streams are now the default Node.js runtime rendering path, so the
opt-in config and runtime selection plumbing are stale. Edge bundles
continue to use the web-stream path because Node streams are unavailable
there.

### How?

- Define `__NEXT_USE_NODE_STREAMS` as true for Node.js app runtime
bundles and false for edge user bundles.
- Remove config, schema, runtime, export, and server plumbing for
`experimental.useNodeStreams`.
- Delete the obsolete env-precedence fixture.
- Clean benchmark docs and scripts that still set or compare
`experimental.useNodeStreams`.

### Verification

- `pnpm --filter=next types`
- `pnpm build-all`

<!-- NEXT_JS_LLM_PR -->
parent 5e144103
......@@ -30,17 +30,6 @@ pnpm bench:render-pipeline \
--artifact-dir=bench/render-pipeline/artifacts/<run>
```
Web vs Node comparison:
```bash
pnpm bench:render-pipeline \
--scenario=e2e \
--stream-mode=both \
--build=true \
--json-out=bench/render-pipeline/artifacts/<run>/results.json \
--artifact-dir=bench/render-pipeline/artifacts/<run>
```
## 3. Minimal-server benchmark (isolated render path)
Use `--scenario=minimal-server` to bypass the router-server layer and measure the render pipeline in isolation. This starts a bare `NextServer` with `minimalMode: true` via `bench/next-minimal-server` — no `router-server`, no middleware, no asset serving. Prefer this when profiling changes to `app-render.tsx`, streaming internals, or Flight serialization where router overhead would add noise.
......
#!/bin/bash
# Benchmark script for comparing web streams vs node streams performance.
# Benchmark script for Node streams render pipeline performance.
# Uses the minimal server (bench/next-minimal-server) for lowest overhead.
# Warms up with 50 requests, then runs two phases:
# Phase 1: 10s at concurrency=1 (single-client latency)
......@@ -104,34 +104,19 @@ run_benchmark() {
stop_server
}
echo "Benchmark: web streams vs node streams"
echo "======================================="
echo "Benchmark: node streams"
echo "======================="
echo "Duration: ${DURATION}s per phase | Warmup: ${WARMUP_REQS} reqs"
echo "Server: minimal-server (minimalMode: true)"
# --- Web Streams (default) ---
cat > next.config.js <<'CONF'
module.exports = {}
CONF
echo ""
echo "Building (web streams)..."
echo "Building..."
node "$NEXT_BIN" build &>/dev/null
run_benchmark "Web Streams (default)"
# --- Node Streams ---
cat > next.config.js <<'CONF'
module.exports = {
experimental: {
useNodeStreams: true,
},
}
CONF
echo ""
echo "Building (node streams)..."
node "$NEXT_BIN" build &>/dev/null
run_benchmark "Node Streams (useNodeStreams: true)"
run_benchmark "Node Streams (default)"
# Restore config
cat > next.config.js <<'CONF'
......
......@@ -3,7 +3,7 @@
This benchmark targets the full App Router render path (`renderToHTMLOrFlight`) via real HTTP requests through `bench/next-minimal-server`.
It supports:
- `web` vs `node` streams mode comparison
- Node streams mode benchmarking
- route-based stress suites for streaming SSR
- CPU/heap profiling for the server process
- Node trace events and Next internal trace artifact capture
......@@ -17,7 +17,7 @@ Runs `next build` + `next start`, exercising the full production stack:
Use this for production-realistic throughput numbers.
```bash
pnpm bench:render-pipeline --scenario=e2e --stream-mode=both
pnpm bench:render-pipeline --scenario=e2e --stream-mode=node
```
### `--scenario=minimal-server`
......@@ -28,7 +28,7 @@ render pipeline from routing/middleware overhead — useful when profiling chang
to `app-render.tsx`, streaming, or Flight serialization.
```bash
pnpm bench:render-pipeline --scenario=minimal-server --stream-mode=both
pnpm bench:render-pipeline --scenario=minimal-server --stream-mode=node
```
When comparing both scenarios, the delta reveals how much overhead the
......@@ -39,7 +39,7 @@ router-server layer adds on top of the raw render path.
Run end-to-end benchmark (default stress routes):
```bash
pnpm bench:render-pipeline --scenario=e2e --stream-mode=both
pnpm bench:render-pipeline --scenario=e2e --stream-mode=node
```
CPU profiling is off by default. Enable with `--capture-cpu=true` for profiling runs.
......@@ -50,13 +50,10 @@ Skip rebuild for faster iteration (after you already built once):
pnpm bench:render-pipeline --scenario=e2e --stream-mode=node --build=false
```
When `--stream-mode=both`, the runner forces `--build=true` so web/node
comparisons do not accidentally reuse stale build output.
Output JSON report:
```bash
pnpm bench:render-pipeline --scenario=e2e --stream-mode=both --json-out=/tmp/render-pipeline.json
pnpm bench:render-pipeline --scenario=e2e --stream-mode=node --json-out=/tmp/render-pipeline.json
```
## Profiling and traces
......@@ -66,7 +63,7 @@ Capture CPU profiles + Node trace events + Next trace logs:
```bash
pnpm bench:render-pipeline \
--scenario=e2e \
--stream-mode=both \
--stream-mode=node \
--capture-cpu=true \
--capture-trace=true \
--capture-next-trace=true
......@@ -78,7 +75,7 @@ Artifacts are written to:
bench/render-pipeline/artifacts/<timestamp>/
```
Per mode (`web` and `node`) this includes:
Per run this includes:
- `<mode>.cpuprofile` (if `--capture-cpu=true`)
- `<mode>.heapprofile` (if `--capture-heap=true`)
- `<mode>-trace-*.json` (if `--capture-trace=true`)
......@@ -118,8 +115,8 @@ pnpm bench:render-pipeline --scenario=e2e --routes=/,/streaming/heavy
The benchmark uses a **closed-loop** load generator: each concurrent worker
issues the next request only after the current one completes. This means:
- **Throughput numbers are reliable for relative comparison** (A/B between stream
modes, before/after a code change). Both sides experience the same measurement
- **Throughput numbers are reliable for relative comparison** (before/after a
code change). Both sides experience the same measurement
model, so deltas are valid.
- **Latency percentiles (p95, max) under load are optimistic.** Slow requests
reduce back-pressure instead of queuing, masking tail latency. Do not compare
......
......@@ -13,7 +13,7 @@ const DEFAULT_ARTIFACTS_ROOT = resolve(
)
type FullRoutePhaseResult = {
mode: 'web' | 'node'
mode: 'node'
route: string
phase: 'single-client' | 'under-load'
requests: number
......@@ -30,7 +30,7 @@ type FullRoutePhaseResult = {
type BenchmarkJson = {
fullResults?: Array<{
mode: 'web' | 'node'
mode: 'node'
routeResults: FullRoutePhaseResult[]
}>
}
......@@ -275,7 +275,7 @@ async function analyzeProfile(
}
function printProfileAnalysis(
mode: 'web' | 'node',
mode: 'node',
analysis: ProfileAnalysis,
top: number
) {
......@@ -315,47 +315,6 @@ function printProfileAnalysis(
}
}
function printComparison(results: BenchmarkJson) {
const fullResults = results.fullResults
if (!fullResults || fullResults.length < 2) return
const web = fullResults.find((entry) => entry.mode === 'web')
const node = fullResults.find((entry) => entry.mode === 'node')
if (!web || !node) return
const webByKey = new Map(
web.routeResults.map((item) => [`${item.route}|${item.phase}`, item])
)
console.log('\n[comparison node vs web]')
console.log(
' route'.padEnd(20) +
'phase'.padEnd(16) +
'RPS delta'.padEnd(14) +
'P95 delta'
)
for (const nodeEntry of node.routeResults) {
const key = `${nodeEntry.route}|${nodeEntry.phase}`
const webEntry = webByKey.get(key)
if (!webEntry) continue
const rpsDelta =
((nodeEntry.throughputRps - webEntry.throughputRps) /
webEntry.throughputRps) *
100
const p95Delta =
((webEntry.latency.p95 - nodeEntry.latency.p95) / webEntry.latency.p95) *
100
const line =
` ${nodeEntry.route}`.padEnd(20) +
`${nodeEntry.phase}`.padEnd(16) +
`${rpsDelta >= 0 ? '+' : ''}${rpsDelta.toFixed(2)}%`.padEnd(14) +
`${p95Delta >= 0 ? '+' : ''}${p95Delta.toFixed(2)}%`
console.log(line)
}
}
async function main() {
const { artifactDirArg, top } = parseArgs()
const runDir = await resolveArtifactRunDir(artifactDirArg)
......@@ -366,29 +325,26 @@ async function main() {
const resultsPath = resolve(runDir, 'results.json')
const resultsRaw = await readFile(resultsPath, 'utf8')
const resultsJson = JSON.parse(resultsRaw) as BenchmarkJson
printComparison(resultsJson)
if (!resultsJson.fullResults || resultsJson.fullResults.length === 0) {
console.log('\nNo benchmark results found in results.json.')
}
const webProfile = resolve(runDir, 'web/web.cpuprofile')
const nodeProfile = resolve(runDir, 'node/node.cpuprofile')
const [webAnalysis, nodeAnalysis] = await Promise.all([
analyzeProfile(webProfile, top),
analyzeProfile(nodeProfile, top),
])
const nodeAnalysis = await analyzeProfile(nodeProfile, top)
if (!webAnalysis && !nodeAnalysis) {
if (!nodeAnalysis) {
console.log('\nNo CPU profiles found in this artifact run.')
console.log(
'This analyzer reads only <mode>/<mode>.cpuprofile artifacts (not trace-event JSON or next-runtime-trace.log).'
)
console.log(
'Run benchmark with --capture-cpu=true, e.g. pnpm bench:render-pipeline --scenario=full --stream-mode=node --capture-cpu=true'
'Run benchmark with --capture-cpu=true, e.g. pnpm bench:render-pipeline --scenario=e2e --stream-mode=node --capture-cpu=true'
)
return
}
if (webAnalysis) printProfileAnalysis('web', webAnalysis, top)
if (nodeAnalysis) printProfileAnalysis('node', nodeAnalysis, top)
printProfileAnalysis('node', nodeAnalysis, top)
console.log('\nDone.')
}
......
......@@ -16,7 +16,7 @@ const MINIMAL_SERVER = resolve(
)
type Scenario = 'minimal-server' | 'e2e'
type StreamMode = 'web' | 'node' | 'both'
type StreamMode = 'node'
type CliOptions = {
scenario: Scenario
......@@ -54,7 +54,7 @@ type BenchStats = {
}
type FullRoutePhaseResult = {
mode: 'web' | 'node'
mode: StreamMode
route: string
phase: 'single-client' | 'under-load'
requests: number
......@@ -65,7 +65,7 @@ type FullRoutePhaseResult = {
}
type FullRunResult = {
mode: 'web' | 'node'
mode: StreamMode
routeResults: FullRoutePhaseResult[]
}
......@@ -130,9 +130,8 @@ Options:
Benchmark options:
--app-dir=<path> (default: bench/basic-app)
--routes=/,/streaming/light,... (default: built-in stress suite)
--stream-mode=web|node|both (default: both)
--stream-mode=node (default: node)
--build=true|false (default: true)
When stream-mode=both, build is forced to true.
--warmup-requests=<number> (default: 50)
Batch size per warmup iteration.
--warmup-until-stable=true|false (default: true)
......@@ -178,15 +177,9 @@ function parseCli(): CliOptions {
)
}
const streamModeRaw = args.get('stream-mode') ?? 'both'
if (
streamModeRaw !== 'web' &&
streamModeRaw !== 'node' &&
streamModeRaw !== 'both'
) {
throw new Error(
`Invalid --stream-mode value: ${streamModeRaw}. Use web|node|both`
)
const streamModeRaw = args.get('stream-mode') ?? 'node'
if (streamModeRaw !== 'node') {
throw new Error(`Invalid --stream-mode value: ${streamModeRaw}. Use node`)
}
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
......@@ -197,13 +190,6 @@ function parseCli(): CliOptions {
const routes = parseRoutes(args.get('routes'))
const build = parseBoolean(args.get('build') ?? 'true')
const shouldForceBuild = streamModeRaw === 'both' && !build
if (shouldForceBuild) {
console.warn(
'[bench/render-pipeline] forcing --build=true for stream-mode=both to avoid comparing stale build output.'
)
}
return {
scenario: scenarioRaw,
......@@ -212,7 +198,7 @@ function parseCli(): CliOptions {
appDir: resolve(REPO_ROOT, args.get('app-dir') ?? 'bench/basic-app'),
routes,
streamMode: streamModeRaw,
build: build || shouldForceBuild,
build,
warmupRequests: parseNumberArg(args, 'warmup-requests', 50),
warmupUntilStable: parseBoolean(args.get('warmup-until-stable') ?? 'true'),
serialRequests: parseNumberArg(args, 'serial-requests', 120),
......@@ -275,15 +261,8 @@ async function ensureNextBuilt() {
}
}
function configForMode(mode: 'web' | 'node'): string {
if (mode === 'web') {
return 'module.exports = {}\n'
}
return `module.exports = {
experimental: {
useNodeStreams: true,
},
}\n`
function defaultConfig(): string {
return 'module.exports = {}\n'
}
async function waitForServerReady(
......@@ -404,50 +383,6 @@ function printFullResults(label: string, results: FullRunResult[]) {
}
}
}
if (results.length === 2) {
const web = results.find((result) => result.mode === 'web')
const node = results.find((result) => result.mode === 'node')
if (web && node) {
console.log('\nComparison (node vs web)')
const joinKeys = new Set(
web.routeResults.map((entry) => `${entry.route}|${entry.phase}`)
)
for (const key of joinKeys) {
const [route, phase] = key.split('|') as [
string,
'single-client' | 'under-load',
]
const webEntry = web.routeResults.find(
(entry) => entry.route === route && entry.phase === phase
)
const nodeEntry = node.routeResults.find(
(entry) => entry.route === route && entry.phase === phase
)
if (!webEntry || !nodeEntry) continue
const throughputDelta =
((nodeEntry.throughputRps - webEntry.throughputRps) /
webEntry.throughputRps) *
100
const p95Delta =
((webEntry.latency.p95 - nodeEntry.latency.p95) /
webEntry.latency.p95) *
100
console.log(` ${route} (${phase})`)
console.log(
` throughput delta: ${throughputDelta >= 0 ? '+' : ''}${throughputDelta.toFixed(2)}%`
)
console.log(
` p95 latency delta: ${p95Delta >= 0 ? '+' : ''}${p95Delta.toFixed(2)}% (positive is better)`
)
}
}
}
}
function buildNodeArgs(
......@@ -540,7 +475,7 @@ async function runWarmup(
async function runRoutePhases(
options: CliOptions,
mode: 'web' | 'node',
mode: StreamMode,
label: string
): Promise<FullRoutePhaseResult[]> {
const routeResults: FullRoutePhaseResult[] = []
......@@ -614,7 +549,7 @@ async function runRoutePhases(
async function runMinimalServerSession(
options: CliOptions,
mode: 'web' | 'node',
mode: StreamMode,
modeArtifactDir: string,
routeSubset: CliOptions
): Promise<FullRoutePhaseResult[]> {
......@@ -658,7 +593,7 @@ async function runMinimalServerSession(
async function runMinimalServerModeBenchmark(
options: CliOptions,
mode: 'web' | 'node'
mode: StreamMode
): Promise<FullRunResult> {
const nextConfigPath = resolve(options.appDir, 'next.config.js')
const originalConfig = await readFile(nextConfigPath, 'utf8')
......@@ -667,7 +602,7 @@ async function runMinimalServerModeBenchmark(
await mkdir(modeArtifactDir, { recursive: true })
try {
await writeFile(nextConfigPath, configForMode(mode))
await writeFile(nextConfigPath, defaultConfig())
if (options.build) {
console.log(`\n[minimal-server/${mode}] building app fixture...`)
......@@ -723,17 +658,8 @@ async function runMinimalServerBenchmarks(
await ensureNextBuilt()
await mkdir(options.artifactDir, { recursive: true })
const modes: Array<'web' | 'node'> =
options.streamMode === 'both' ? ['web', 'node'] : [options.streamMode]
const results: FullRunResult[] = []
for (let i = 0; i < modes.length; i++) {
if (i > 0) {
console.log('[minimal-server] waiting 2s for port cleanup...')
await sleep(2000)
}
results.push(await runMinimalServerModeBenchmark(options, modes[i]))
}
results.push(await runMinimalServerModeBenchmark(options, options.streamMode))
return results
}
......@@ -743,7 +669,7 @@ async function runMinimalServerBenchmarks(
async function runE2EServerSession(
options: CliOptions,
mode: 'web' | 'node',
mode: StreamMode,
modeArtifactDir: string,
routeSubset: CliOptions
): Promise<FullRoutePhaseResult[]> {
......@@ -786,7 +712,7 @@ async function runE2EServerSession(
async function runE2EModeBenchmark(
options: CliOptions,
mode: 'web' | 'node'
mode: StreamMode
): Promise<FullRunResult> {
const nextConfigPath = resolve(options.appDir, 'next.config.js')
const originalConfig = await readFile(nextConfigPath, 'utf8')
......@@ -795,7 +721,7 @@ async function runE2EModeBenchmark(
await mkdir(modeArtifactDir, { recursive: true })
try {
await writeFile(nextConfigPath, configForMode(mode))
await writeFile(nextConfigPath, defaultConfig())
if (options.build) {
console.log(`\n[e2e/${mode}] building app fixture...`)
......@@ -844,17 +770,8 @@ async function runE2EBenchmarks(options: CliOptions): Promise<FullRunResult[]> {
await ensureNextBuilt()
await mkdir(options.artifactDir, { recursive: true })
const modes: Array<'web' | 'node'> =
options.streamMode === 'both' ? ['web', 'node'] : [options.streamMode]
const results: FullRunResult[] = []
for (let i = 0; i < modes.length; i++) {
if (i > 0) {
console.log('[e2e] waiting 2s for port cleanup...')
await sleep(2000)
}
results.push(await runE2EModeBenchmark(options, modes[i]))
}
results.push(await runE2EModeBenchmark(options, options.streamMode))
return results
}
......
......@@ -226,6 +226,9 @@ module.exports = ({ dev, turbo, bundleType, experimental, ...rest }) => {
'process.env.__NEXT_EXPERIMENTAL_REACT': JSON.stringify(
experimental ? true : false
),
...(bundleType === 'app' || bundleType === 'app-worker'
? { 'process.env.__NEXT_USE_NODE_STREAMS': JSON.stringify(true) }
: {}),
'process.env.NEXT_RUNTIME': JSON.stringify('nodejs'),
'process.turbopack': JSON.stringify(turbo),
'process.env.TURBOPACK': JSON.stringify(turbo),
......
......@@ -124,7 +124,6 @@ export function getDefineEnv({
const isPPREnabled = checkIsAppPPREnabled(config.experimental.ppr)
const isCacheComponentsEnabled = !!config.cacheComponents
const isUseCacheEnabled = !!config.experimental.useCache
const isUseNodeStreamsEnabled = !!config.experimental.useNodeStreams
const defineEnv: DefineEnv = {
// internal field to identify the plugin config
......@@ -181,9 +180,7 @@ export function getDefineEnv({
),
'process.env.__NEXT_INSTANT_NAV_TOGGLE': isCacheComponentsEnabled,
'process.env.__NEXT_USE_CACHE': isUseCacheEnabled,
'process.env.__NEXT_USE_NODE_STREAMS': isEdgeServer
? false
: isUseNodeStreamsEnabled,
'process.env.__NEXT_USE_NODE_STREAMS': isEdgeServer ? false : true,
'process.env.NEXT_SUPPORTS_IMMUTABLE_ASSETS':
config.experimental.supportsImmutableAssets || false,
......
......@@ -61,7 +61,6 @@ export interface ExportPageInput {
debugOutput?: boolean
nextConfigOutput?: NextConfigComplete['output']
enableExperimentalReact?: boolean
enableNodeStreams?: boolean
sriEnabled: boolean
renderResumeDataCache: RenderResumeDataCache | undefined
}
......
......@@ -82,7 +82,6 @@ async function exportPageImpl(
disableOptimizedLoading,
debugOutput = false,
enableExperimentalReact,
enableNodeStreams,
trailingSlash,
sriEnabled,
renderOpts: commonRenderOpts,
......@@ -96,9 +95,6 @@ async function exportPageImpl(
if (enableExperimentalReact) {
process.env.__NEXT_EXPERIMENTAL_REACT = 'true'
}
if (enableNodeStreams) {
process.env.__NEXT_USE_NODE_STREAMS = 'true'
}
const {
path,
......@@ -438,7 +434,6 @@ export async function exportPages(
httpAgentOptions: nextConfig.httpAgentOptions,
debugOutput: options.debugOutput,
enableExperimentalReact: needsExperimentalReact(nextConfig),
enableNodeStreams: !!nextConfig.experimental.useNodeStreams,
sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),
buildId: input.buildId,
deploymentId: input.deploymentId,
......
/**
* Web stream operations for the rendering pipeline.
* Loaded by stream-ops.ts when __NEXT_USE_NODE_STREAMS is false (default).
* Loaded by stream-ops.ts when __NEXT_USE_NODE_STREAMS is false, such as edge
* bundles where Node.js streams are unavailable.
*
* AnyStream = AnyStreamType so the exported type surface matches stream-ops.node.ts,
* allowing the switcher to assign either module without `as unknown as`.
......
......@@ -429,7 +429,6 @@ export const experimentalSchema = {
authInterrupts: z.boolean().optional(),
useCache: z.boolean().optional(),
useCacheTimeout: z.number().positive().optional(),
useNodeStreams: z.boolean().optional(),
slowModuleDetection: z
.object({
buildTimeThresholdMs: z.number().int(),
......
......@@ -1144,13 +1144,6 @@ export interface ExperimentalConfig {
*/
useCache?: boolean
/**
* Use Node.js native streams instead of web streams for the App Router
* rendering pipeline on the Node.js runtime. This can improve performance
* by avoiding the overhead of web stream wrappers.
*/
useNodeStreams?: boolean
/**
* Enables detection and reporting of slow modules during development builds.
* Enabling this may impact build performance to ensure accurate measurements.
......@@ -2069,7 +2062,6 @@ export const defaultConfig = Object.freeze({
gestureTransition: false,
inlineCss: false,
useCache: undefined,
useNodeStreams: true,
slowModuleDetection: undefined,
globalNotFound: false,
browserDebugInfoInTerminal: 'warn',
......@@ -2189,7 +2181,6 @@ export interface NextConfigRuntime {
| 'cachedNavigations'
| 'exposeTestingApiInProductionBuild'
| 'supportsImmutableAssets'
| 'useNodeStreams'
| 'instantInsights'
> & {
// Pick on @internal fields generates invalid .d.ts files
......@@ -2259,7 +2250,6 @@ export function getNextConfigRuntime(
cachedNavigations: ex.cachedNavigations,
exposeTestingApiInProductionBuild: ex.exposeTestingApiInProductionBuild,
supportsImmutableAssets: ex.supportsImmutableAssets,
useNodeStreams: ex.useNodeStreams,
instantInsights: ex.instantInsights,
trustHostHeader: ex.trustHostHeader,
......
......@@ -1651,28 +1651,9 @@ function finalizeConfig(config: NextConfigComplete): NextConfigComplete {
validationLevel:
config.experimental.instantInsights?.validationLevel ?? 'warning',
}
syncUseNodeStreamsEnv(config)
return config
}
function syncUseNodeStreamsEnv(config: NextConfig): void {
// This must use resolved config: user configs are inspected before defaults
// are merged, while runtime bundles must select the default implementation.
const useNodeStreams = config.experimental?.useNodeStreams
? 'true'
: undefined
if (useNodeStreams) {
process.env.__NEXT_USE_NODE_STREAMS = useNodeStreams
} else {
delete process.env.__NEXT_USE_NODE_STREAMS
}
// Dev env reloads restore process.env from this snapshot. Preserve the
// resolved runtime selection so a reload cannot mix stream implementations.
updateInitialEnv({ __NEXT_USE_NODE_STREAMS: useNodeStreams })
}
async function applyModifyConfig(
config: NextConfigComplete,
phase: PHASE_TYPE,
......@@ -1800,7 +1781,6 @@ export default async function loadConfig(
return cachedResult.rawConfig
}
syncUseNodeStreamsEnv(cachedResult.config)
return cachedResult.config
} else {
// Reset next.config errors before loading config
......@@ -1828,8 +1808,6 @@ export default async function loadConfig(
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG
)
syncUseNodeStreamsEnv(standaloneConfig)
// Cache the standalone config
configCache.set(cacheKey, {
config: standaloneConfig,
......@@ -2273,15 +2251,6 @@ function enforceExperimentalFeatures(
}
}
// Enable node streams via env var (for CI testing).
if (
process.env.__NEXT_USE_NODE_STREAMS === 'true' &&
(config.experimental.useNodeStreams === undefined ||
(isDefaultConfig && !config.experimental.useNodeStreams))
) {
config.experimental.useNodeStreams = true
}
// TODO: Remove this once strictRouteTypes is the default.
if (
process.env.__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES === 'true' &&
......
......@@ -222,9 +222,6 @@ export default class NextNodeServer extends BaseServer<
if (this.renderOpts.nextScriptWorkers) {
process.env.__NEXT_SCRIPT_WORKERS = JSON.stringify(true)
}
if (this.nextConfig.experimental.useNodeStreams) {
process.env.__NEXT_USE_NODE_STREAMS = 'true'
}
if (!this.minimalMode) {
this.imageResponseCache = new ResponseCache(this.minimalMode)
......
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
useNodeStreams: false,
},
}
module.exports = nextConfig
import { nextTestSetup } from 'e2e-utils'
describe('use-node-streams env precedence', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
env: {
__NEXT_USE_NODE_STREAMS: 'true',
},
})
it('should respect explicit useNodeStreams=false even when env flag is true', async () => {
const { exitCode, cliOutput } = await next.build()
expect(exitCode).toBe(0)
expect(cliOutput).toContain('useNodeStreams')
})
})
......@@ -22368,15 +22368,6 @@
"flakey": [],
"runtimeError": false
},
"test/production/app-dir/use-node-streams-env-precedence/use-node-streams-env-precedence.test.ts": {
"passed": [
"use-node-streams env precedence should respect explicit useNodeStreams=false even when env flag is true"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/production/app-dir/worker-restart/worker-restart.test.ts": {
"passed": [
"worker-restart should fail the build if a worker process is killed",
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment