Track production errors automatically so you know about issues before your users report them.
- Go to sentry.io (free tier available for small apps)
- Create a new project and select "Next.js"
npx @sentry/wizard@latest -i nextjsThis automatically:
- Installs
@sentry/nextjs - Creates
sentry.client.config.tsandsentry.server.config.ts - Updates
next.config.tswith Sentry webpack plugin
Add to .env.local (local) and Vercel Dashboard (production):
SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
NEXT_PUBLIC_SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
SENTRY_AUTH_TOKEN=sntrys_xxx # For source maps uploadTrigger a test error and check Sentry Dashboard:
// Temporary test - remove after verification
throw new Error("Sentry test error")- Automatic error capture (client + server)
- Stack traces with source maps
- Error grouping and deduplication
- Email alerts for new errors
- Performance monitoring (optional)
Vercel Error Tracking - Built-in, simpler, but fewer features. Available in Vercel Dashboard under "Monitoring".