Installation
Setup
Createinstrumentation.ts in your project root (or src/instrumentation.ts if using the src/ layout):
instrumentation.ts
Next.js 14 requires an extra config line
Next.js 14 requires an extra config line
next.config.js
Middleware
Wrap your middleware to capture edge function errors:middleware.ts
API Route Handlers
Wrap App Router route handlers:app/api/users/route.ts
Error Boundary (Client)
Use inlayout.tsx to wrap page content. Do not use inside error.tsx — App Router’s error.tsx is already an error boundary.
app/providers.tsx
app/layout.tsx
Manual Capture
Source Maps
Production stack traces are minified. Upload source maps for readable traces:Configuration
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | Required | Project API key (sq_pk_...) |
projectId | string | Required | Project ID (UUID from dashboard) |
endpoint | string | https://ingest.squasher.ai | Ingestion endpoint |
environment | string | — | Environment tag |
release | string | — | Release version (e.g. git SHA) |
sampleRate | number | 1 | Sample rate 0-1 |
debug | boolean | false | Log SDK activity to console |
beforeSend | function | — | Return event to send, or null to drop |