vercel / vercel/next.js

Instrumentation hook is not called in standalone output

Open
#81,050 4 comments 0 reactions 1 assignee View on GitHub

@icyJoseph is already working on this.

Since Jun 30, 2025.

Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/AOEChamp/nextjs-standalone-instrumentation-bug

To Reproduce
npm run build
node .next/standalone/server.js
Current vs. Expected behavior

Standalone build run will pickup the instrumentation.ts from the src directory and print "instrumentation SRC." If the instrumentation.ts is not in the src directory, it will not run. npm run dev works correctly with the root instrumentation. This is confusing and not clearly explained in the docs: https://nextjs.org/docs/app/guides/instrumentation

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Thu Mar  6 21:58:56 PST 2025; root:xnu-10063.141.1.704.6~1/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.3.4 // Latest available version is detected (15.3.4).
  eslint-config-next: 15.3.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: standalone
Which area(s) are affected? (Select all that apply)

Not sure

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

next build (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.