-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Description
Link to the code that reproduces this issue
https://github.com/scinscinscin/instrepro
To Reproduce
- Clone repo and push to vercel as project.
- Hit the
/api/helloendpoint - Check logs and see that the console.log() call inside
instrumentation.server.tsfile 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.