Migrate from 2.x to 3.x

Learn about migrating from Sentry Capacitor SDK 2.x to 3.x

Version 3 of the Sentry Capacitor SDK introduces API cleanup, version support changes, and adds Capacitor 8 support.

The main goal of version 3 of Sentry Capacitor SDK is to provide compatibility with Sentry JavaScript version 10. To achieve this, the update includes breaking changes including the removal of deprecated APIs, reorganization of the npm package structure and also the refactoring on how you initialize Sentry Capacitor.

iOS, macOS, and tvOS have increased minimum version requirements:

  • iOS: 15.0+ (previously 11.0+)
  • macOS: 10.14+ (previously 10.13+)
  • tvOS: 15.0+ (previously 11.0+)

If you are using a self-hosted Sentry instance, we recommend using version 24.4.2 or higher for full feature support.

This update contains API cleanups related to BaseClient, hasTracingEnabled, and logger from @sentry/core. Each Sibling SDK has specific changes in version 10, follow the guides below to update the SDK.

This section describes the changes in Sentry Capacitor SDK, version 3.

Starting in version 3.0.0, Vue and Nuxt options must be nested inside siblingOptions rather than passed directly to Sentry.init().

Copied
import * as Sentry from '@sentry/capacitor';
import * as SentryVue from '@sentry/vue';

Sentry.init({
- app: app,
- attachErrorHandler: false,
- attachProps: true,
- tracingOptions: { ... },
  dsn: '...',
+ siblingOptions: {
+   vueOptions: {
+     app: app,
+     attachErrorHandler: false,
+     attachProps: true,
+     tracingOptions: { ... },
+   },
+ },
}, SentryVue.init);

The following APIs have been removed or renamed:

  • BaseClient → use Client instead
  • hasTracingEnabled() → use hasSpansEnabled() instead
  • Internal logger exports from @sentry/core → use debug and SentryDebugLogger types

Logging options have been moved out of the _experiments namespace. Update your configuration as follows:

Copied
Sentry.init({
  dsn: '...',
- _experiments: {
-   enableLogs: true,
-   beforeSendLog: (log) => log,
- },
+ enableLogs: true,
+ beforeSendLog: (log) => log,
});

This version restores several integrations that were previously missing and adds a new Spotlight integration that works on both Web and Mobile. The following integrations are now available:

Auto EnabledErrorsTracingReplayAdditional Context
breadcrumbsIntegration
browserApiErrorsIntegration
dedupeIntegration
functionToStringIntegration
globalHandlersIntegration
inboundFiltersIntegration
linkedErrorsIntegration
spotlightIntegration
Was this helpful?
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").