Integrations

Learn more about how integrations extend the functionality of our SDK to cover common libraries and environments automatically.

Sentry provides a number of integrations which are designed to add automatic instrumentation to your application. Some of these integrations are enabled by default, while others have to be explicitly enabled.

Next.js can operate within three runtimes: the Node.js runtime, the browser runtime, and the Edge runtime. However, it's important to note that not all integrations are compatible with all of these runtimes.

Depending on whether an integration enhances the functionality of a particular runtime, such as the BrowserTracing integration for the browser runtime or the RequestData integration for the Node.js runtime, you can only include these integrations in their respective configuration files:

  • For the browser runtime, add integrations to sentry.client.config.(js|ts).
  • For Node.js, add integrations to your Sentry setup in instrumentation.(js|ts).
  • For the Edge runtime, add integrations to your Sentry setup in instrumentation.(js|ts).

To disable system integrations, set defaultIntegrations: false when calling init().

To override their settings, provide a new instance with your config to the integrations option. For example, to turn off browser capturing console calls:

Copied
Sentry.init({
  dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',

  integrations: [
    Sentry.linkedErrorsIntegration({
      limit: 7,
    }),
  ],
});

You can add additional integrations in your init call:

Copied
import * as Sentry from '@sentry/browser';

Sentry.init({
  dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',
  integrations: [Sentry.reportingObserverIntegration()],
});

Alternatively, you can add integrations lazily via Sentry.addIntegration(). This is useful if you only want to enable an integration in a specific environment or if you want to lazy-load an integration. For all other cases, we recommend you use the integrations option.

Copied
import * as Sentry from '@sentry/browser';

Sentry.init({
  integrations: [],
});

Sentry.addIntegration(Sentry.reportingObserverIntegration());

If you only want to remove a single or some of the default integrations, instead of disabling all of them with defaultIntegrations: false, you can use the following syntax to filter out the ones you don't want.

This example removes the integration for adding breadcrumbs to the event, which is enabled by default:

Copied
Sentry.init({
  // ...
  integrations: function (integrations) {
    // integrations will be all default integrations
    return integrations.filter(function (integration) {
      return integration.name !== 'Breadcrumbs';
    });
  },
});

You can also create custom integrations.

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").