Integrations · JavaScript framework

Pagerless for Next.js

One line in `instrumentation.ts` covers pages, layouts, route handlers, server actions and middleware, on Node and the edge.

Set up

npm i pagerless
instrumentation.ts
export { register, onRequestError } from "pagerless/next";

Works with the app router and the pages router. onRequestError needs Next.js 15 or newer. Edge route handlers can also be wrapped: export const GET = withPagerless(handler).

npx pagerless connect writes this file for you when it finds next in package.json.

What it catches

  • Errors in pages, layouts, route handlers, server actions and middleware.
  • Reports 5xx and crashes only, never 4xx, and leaves the response, logs and error exactly as they were.
  • On Node it also starts the SDK: uncaught errors and unhandled rejections, status and latency per route, failing outbound calls (Stripe, OpenAI, Supabase and others named), a heartbeat every 60 seconds and a deploy marker.

Questions

Does it catch errors in React components in the browser?

Add pagerless/browser and, if you like, the React error boundary.

Can Pagerless roll back a bad Next.js deploy?

On Vercel and Netlify, yes, after your approval. See Next.js on Vercel.

Updated .

Free for you and one backup · 3 apps · no card

Sleep through the small stuff.

Run one command in your repo. Pagerless shows every change before it makes it.

npx pagerless connect