nextjs - 💡(How to fix) Fix Instrumentation file is not called when custom page extensions are used *in Vercel* [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86117Fetched 2026-04-08 02:12:33
View on GitHub
Comments
3
Participants
3
Timeline
12
Reactions
4
Timeline (top)
commented ×3labeled ×3subscribed ×3cross-referenced ×1

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 14435
  Available CPU cores: 16
Binaries:
  Node: 24.8.0
  npm: 11.6.0
  Yarn: 1.22.22
  pnpm: 8.15.7
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
Done in 2.93s.
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/scinscinscin/instrepro

To Reproduce

  1. Clone repo and push to vercel as project.
  2. Hit the /api/hello endpoint
  3. Check logs and see that the console.log() call inside instrumentation.server.ts file is not called

Current vs. Expected behavior

I expect "Registering instrumentation (inside register fn)..." to be printed in the logs of the function

Currently, there's nothing printed, leading me to suspect that instrumentation.ts is never called.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 14435
  Available CPU cores: 16
Binaries:
  Node: 24.8.0
  npm: 11.6.0
  Yarn: 1.22.22
  pnpm: 8.15.7
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
Done in 2.93s.

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

Pages Router, TypeScript, Turbopack

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

Vercel (Deployed)

Additional context

This is all in pages router. I do not know if this happens for app router.

WHERE IT WORKS: instrumentation.ts is called (when you're not using page extensions). You can deploy the initial commit in the repository and see that it works. It also works in local dev and local prod builds.

WHERE IT DOESN'T WORK: If you add a page extension in next.config.ts like server.ts and rename the instrumentation file as well, it doesn't work in Vercel BUT it works in local prod and local dev builds.

So the breaking scenario is Vercel + Pages Router (unsure if it happens in App Router) + With Custom Page Extensions.

I wanted to report this to Vercel but there's this post in their forum that says its a next.js feature, so I don't know where to put it.

extent analysis

TL;DR

The issue might be resolved by adjusting the Next.js configuration or the custom page extension implementation to ensure the instrumentation.ts file is properly executed in the Vercel environment with Pages Router.

Guidance

  • Verify that the instrumentation.ts file is correctly referenced and imported in the project, especially after renaming it to instrumentation.server.ts.
  • Check the Next.js documentation and Vercel deployment guides for any specific requirements or limitations related to custom page extensions and instrumentation files.
  • Test the project with the App Router instead of Pages Router to determine if the issue is specific to one or the other.
  • Review the differences in configuration and implementation between local dev/prod builds and Vercel deployments to identify potential discrepancies.

Example

No specific code example can be provided without further details on the implementation, but ensuring that the instrumentation.server.ts file is correctly imported and executed in the context of the custom page extension is crucial.

Notes

The issue seems to be related to the interaction between Next.js, custom page extensions, and Vercel's deployment environment. Further investigation into the specifics of the Next.js configuration, the custom page extension implementation, and how Vercel handles these aspects is necessary to pinpoint the exact cause.

Recommendation

Apply a workaround by adjusting the Next.js configuration or custom page extension implementation, as the issue seems to be related to how these components interact with each other in the Vercel environment. This approach allows for a more targeted fix without waiting for potential updates or fixes from Next.js or Vercel.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Instrumentation file is not called when custom page extensions are used *in Vercel* [3 comments, 3 participants]