Migrate from 7.x to 8.x

The main goal of version 8 is to improve our performance monitoring APIs, integrations API, and ESM support. This version is breaking because we removed deprecated APIs, restructured npm package contents, and introduced new dependencies on OpenTelemetry.

Before updating to 8.x of the SDK, we recommend upgrading to the latest version of 7.x. To fix all deprecations on 7.x, you can use the @sentry/migr8 codemod to automatically update your SDK usage. @sentry/migr8 requires Node 18+.

Copied
npx @sentry/migr8@latest

Our migration tool will let you select which updates to run, and automatically update your code. In some cases, we cannot automatically change code for you. These will be marked with a TODO(sentry) comment instead. Make sure to review all code changes after running @sentry/migr8!

Please see our detailed migration guide for more information on migrating from 7.x to 8.x.

If you only use basic features of Sentry, or you simply copy & pasted the setup examples from our docs, here's what changed for you:

  • If you installed additional Sentry packages, such as@sentry/profiling-node alongside your Sentry SDK (e.g. @sentry/react or @sentry/node), make sure to upgrade all of them to version 8. In addition, the @sentry/hub, @sentry/tracing, @sentry/integrations, @sentry/serverless, and @sentry/replay package have all been removed.

  • Our SDKs now generate ES2018+ compatible code. This means we now only support Node 14.18 or higher and ES2018 compatible browsers. New minimum supported browsers:

    • Chrome 63
    • Edge 79
    • Safari/iOS Safari 12
    • Firefox 58
    • Opera 50
    • Samsung Internet 8.2

For IE11 support please transpile your code to ES5 using babel or similar and add required polyfills.

  • Integrations are now functional instead of class based. For example, the import for session replay uses Sentry.replayIntegration instead of new Sentry.Replay.

  • The SDK's Performance API has been revamped. More details can be found in documentation about the new Performance Monitoring APIs

  • Initializing the Node SDK has been vastly simplified. You no longer need to use autoDiscoverNodePerformanceMonitoringIntegrations or use Sentry.Handlers, as these are now automatically included by the SDK without configuration. To make this work, you now have to ensure Sentry.init is initialized before any other code is imported and used.

Copied
// In v7, this was fine:
const Sentry = require("@sentry/node");
const express = require("express");

Sentry.init({
  // ...
});

const app = express();

// ...

// In v8, in order to ensure express is instrumented,
// you have to initialize before you import:
const Sentry = require("@sentry/node");
Sentry.init({
  // ...
});

const express = require("express");
const app = express();

Sentry.setupExpressErrorHandler(app);
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").