onRequestError
A function exported from instrumentation.ts, added in Next.js 15, that receives every uncaught server error with request and route details.
In more detail
Next.js calls it with the error, the request and details such as the route and whether it was rendering or running an action. Send the error to your monitoring service from here to capture every server failure in one place.
Related terms
- instrumentation — Code, often a library, that makes an application emit telemetry about its operations.
- exception — An error object a program raises to stop normal flow and report that something went wrong.
Taught in
- Instrumentation: OpenTelemetry & Performance Spans — Next.js 15 & Modern App Router Architecture