Sentry SDK v7 → Sentry SDK v8
mediumSentry v8 brings OpenTelemetry integration, smaller bundle, and auto-instrumentation. Init order matters — v8 is strict about it.
Estimated: 2-4h · 5 steps
Progress0%
Step 1: Upgrade package
npm install @sentry/node@latest @sentry/browser@latest
Step 2: Fix init order
Sentry.init() must be the FIRST thing that runs. Use --require or instrumentation.ts.
// instrumentation.ts (Next.js)
import * as Sentry from '@sentry/nextjs'
Sentry.init({ dsn: process.env.SENTRY_DSN })Step 3: Update custom integrations
setupOnce() removed. Use setup() and processEvent() instead. Check the migration guide.
Step 4: Remove deprecated APIs
Sentry.configureScope() → Sentry.withScope(). Hub.run() removed. getCurrentScope() is the new API.
Step 5: Verify
✓ Errors appear in Sentry dashboard. Traces captured. Bundle size reduced.