Edge runtime analysis incorrectly checks nodejs-only APIs in dev mode.
The issue involves incorrect analysis of nodejs-only APIs in the edge runtime during dev mode, causing unnecessary console warnings. The fix requires understanding the edge runtime's behavior and the instrumentation hook's execution context. The scope is somewhat clear but involves runtime-specific nuances.
https://github.com/blairmcalpine/instrumentation-errors-repro
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: 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:
fs, but accessing the process global seems to cause problems.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 versi
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!