nextjs - 💡(How to fix) Fix onRequestError is not triggered for middleware when runtime is nodejs [1 comments, 2 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#84181Fetched 2026-04-08 02:20:23
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
subscribed ×2commented ×1issue_type_added ×1labeled ×1

Error Message

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:12:01 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T8132
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.12.0
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.17.1
Relevant Packages:
  next: 15.6.0-canary.27 // Latest available version is detected (15.6.0-canary.27).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/yiminghe/on-request-error-bug

To Reproduce

  1. pnpm dev
  2. open http://localhost:3000/
  3. check console

Current vs. Expected behavior

current (15.5.x, canary when runtime is nodejs): no 'onRequestError' in console

expected(same with when not set runtime): 'onRequestError' in console

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:12:01 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T8132
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.12.0
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.17.1
Relevant Packages:
  next: 15.6.0-canary.27 // Latest available version is detected (15.6.0-canary.27).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: N/A

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

Error Handling

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

Other (Deployed)

Additional context

No response

extent analysis

TL;DR

The issue can likely be resolved by investigating the differences in behavior between the onRequestError handling in Next.js version 15.5.x and the canary version when the runtime is set to Node.js.

Guidance

  • Review the onRequestError handling code in the provided GitHub repository to understand how it is expected to behave.
  • Compare the behavior of onRequestError in Next.js version 15.5.x with the canary version to identify any changes that might be causing the issue.
  • Check the Next.js documentation for any changes or updates to error handling in version 15.6.0-canary.27.
  • Verify that the onRequestError function is properly configured and enabled in the Next.js config.

Example

No code snippet is provided as the issue lacks specific code details.

Notes

The issue seems to be related to a specific version of Next.js and its interaction with the onRequestError handling. Without more information about the code or the exact changes made, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: The issue might be resolved by downgrading to a previous version of Next.js where the onRequestError handling is known to work as expected, until the issue is fixed in the canary version.

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 onRequestError is not triggered for middleware when runtime is nodejs [1 comments, 2 participants]