Skip to content

Next.js standalone output does not run Node.js instrumentation code #89377

@yunsii

Description

@yunsii

Link to the code that reproduces this issue

https://github.com/yunsii/turbopack-test

To Reproduce

  1. npm install
  2. npm run dev
  3. Observe console output (see "Current vs. Expected behavior")
  4. npm run build
  5. npm run start
  6. Observe console output (see "Current vs. Expected behavior")
  7. node .next/standalone/server.js
  8. Observe console output (see "Current vs. Expected behavior")

Current vs. Expected behavior

Expected behavior (next dev)

> turbopack-test@0.1.0 dev /home/XXX/work/turbopack-test
> next dev

▲ Next.js 16.2.0-canary.23 (Turbopack)
- Local:         http://localhost:3000
- Network:       http://10.255.255.254:3000
✓ Ready in 288ms
Registering instrumentation... nodejs
Node.js runtime detected
🚀 ~ register ~ globalThis._instrumentation_registered: true
Instrumentation successfully registered. true

Expected behavior (next start)

> turbopack-test@0.1.0 start
> next start

▲ Next.js 16.2.0-canary.23
- Local:         http://localhost:3000
- Network:       http://10.255.255.254:3000
✓ Ready in 114ms
⚠ "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.
Registering instrumentation... nodejs
Node.js runtime detected
🚀 ~ register ~ globalThis._instrumentation_registered: true
Instrumentation successfully registered. true

Current behavior (node .next/standalone/server.js)

▲ Next.js 16.2.0-canary.23
- Local:         http://localhost:3000
- Network:       http://0.0.0.0:3000
✓ Ready in 0ms

Issue: node .next/standalone/server.js does not run any instrumentation code. The instrumentation code cannot be found in the standalone directory.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 58254
  Available CPU cores: 20
Binaries:
  Node: 22.18.0
  npm: 10.9.3
  Yarn: 1.22.22
  pnpm: 10.15.1
Relevant Packages:
  next: 16.2.0-canary.23 // Latest available version is detected (16.2.0-canary.23).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Instrumentation, Output, Runtime

Which stage(s) are affected? (Select all that apply)

next build (local), next dev (local)

Additional context

  • Using output: "standalone" configuration for the build.
  • Issue only occurs when running node .next/standalone/server.js. Both next dev and next start work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    InstrumentationRelated to Next.js Instrumentation.OutputRelated to the the output configuration option.RuntimeRelated to Node.js or Edge Runtime with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions