Skip to main content

Quickstart

1

Install

npm install @squasher/nextjs
2

Initialize

Create instrumentation.ts in your project root:
instrumentation.ts
import { init } from '@squasher/nextjs';

init({
  apiKey: process.env.SQUASHER_API_KEY!,
  projectId: process.env.SQUASHER_PROJECT_ID!,
  environment: process.env.NODE_ENV,
});
Enable the instrumentation hook in next.config.js:
next.config.js
module.exports = {
  experimental: { instrumentationHook: true },
};
This is automatic in Next.js 15+.
Place the file at src/instrumentation.ts instead.
3

Add environment variables

Find your API key and project ID in Dashboard > Settings > API Keys.
.env.local
SQUASHER_API_KEY=sq_pk_your_key_here
SQUASHER_PROJECT_ID=your-project-uuid
4

Verify

Trigger a test error, then check your dashboard. The error should appear within seconds with an AI triage summary.

Full Next.js SDK docs

Middleware, API routes, error boundaries, breadcrumbs, and more.

Troubleshooting

  1. Check your API key starts with sq_pk_ and matches the project
  2. Add debug: true to init() and check console for [squasher] messages
  3. Check the Network tab for POST requests to ingest.squasher.ai202 means accepted, 401 means bad key, 429 means you hit your event limit
  4. For log drains, wait at least a minute (Vercel batches deliveries)
Upload source maps so Squasher can resolve original file names and line numbers. See Source Maps.
See the full Troubleshooting page.