# Next.js on Vercel

> The most common stack for apps built with AI, and the one where Pagerless can do the most: catch it, explain it, roll it back.

URL: https://pagerless.dev/integrations/nextjs-vercel
Updated: 2026-10-22

1. **Install** In your Next.js project:

   ```
   npm i pagerless
   ```
2. **Add the instrumentation file** Pages, route handlers, server actions and middleware, on Node and the edge. onRequestError needs Next.js 15 or newer (pagerless 0.2.0).

   ```
   // instrumentation.ts
   export { register, onRequestError } from "pagerless/next";
   ```
3. **Add the key** Set it for production only, so previews stay quiet.

   ```
   vercel env add PAGERLESS_KEY production
   ```
4. **Allow rollback** In the Pagerless app, connect Vercel with an access token. Rolling back then takes one approval.

Or run `npx pagerless connect` and it does steps 1 to 3.

## What Pagerless reads from Vercel

`VERCEL_ENV` and `VERCEL_GIT_COMMIT_SHA` become the environment and release, so a spike right after a deploy is tied to that deploy. Vercel's deploy webhooks, signed with your secret, are accepted too.
