`next dev`: Instrumentation hook is still analyzed for the edge runtime despite never running in the edge runtime
Link to the code that reproduces this issue
https://github.com/blairmcalpine/instrumentation-errors-repro
To Reproduce
- npm install
- npm run dev
- Visit http://localhost:3000
- See the error in your console:
Ecmascript file had an error
1 | export const register = async () => {
2 | console.log("registering instrumentation", process.env.NEXT_RUNTIME);
> 3 | process.on("unhandledRejection", (reason, promise) => {
| ^^^^^^^^^^
4 | console.error("Unhandled rejection:", reason);
5 | console.error("Promise:", promise);
6 | });`
Current vs. Expected behavior
Current: There is an error logged from analysis of the instrumentation hook for edge runtimes, despite the instrumentation hook never running in the edge runtime. This error doesn't actually break anything at runtime it seems.
Expected: No error should appear. With the new proxy.ts enabling a full nodejs runtime version of Next.js, the instrumentation hook never runs its "edge" version (verified via the console log in the minimal repro, the register hook only runs with process.env.NEXT_RUNTIME set to "nodejs"). Despite this, it seems like there is still some checking for nodejs-only APIs running for the instrumentation hook, which produce console warnings.
If this helps debug:
- notably the warnings only appear after you visit a page, and not when the initial instrumentation hook is run.
- It doesn't seem to produce the same warnings when using
fs, but accessing theprocessglobal seems to cause problems. - This only happens in dev mode, not production.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Aug 11 21:15:09 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 14
Binaries:
Node: 22.15.1
npm: 10.9.2
Yarn: 1.22.22
pnpm: N/A
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
Which area(s) are affected? (Select all that apply)
Instrumentation, Middleware
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
Hello, I'm interested in this PR! I would like to help!