Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`next dev`: Instrumentation hook is still analyzed for the edge runtime despite never running in the edge runtime | GoodFirstPicks

`next dev`: Instrumentation hook is still analyzed for the edge runtime despite never running in the edge runtime

vercel/next.js 5 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Edge runtime analysis incorrectly checks nodejs-only APIs in dev mode.

AI Summary

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.

Issue Description

Link to the code that reproduces this issue

https://github.com/blairmcalpine/instrumentation-errors-repro

To Reproduce

  1. npm install
  2. npm run dev
  3. Visit http://localhost:3000
  4. 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:

  1. notably the warnings only appear after you visit a page, and not when the initial instrumentation hook is run.
  2. It doesn't seem to produce the same warnings when using fs, but accessing the process global seems to cause problems.
  3. 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 versi

GitHub Labels

Middlewarelinear: nextInstrumentation

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • edge runtime analysis
  • dev mode specific
  • process global access
Loading labels...

Details

Points10 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno