-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Feat(Capcitor): Add Capacitor v3 migration guide #15740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: Spotlight | ||
| description: "The Spotlight integration enables real-time observability for errors, traces, logs, and performance data during local development." | ||
| --- | ||
|
|
||
| <Alert level="info"> | ||
| The `spotlightIntegration` is only supported in Sentry Capacitor SDK 3.0.0 and newer. | ||
| </Alert> | ||
|
|
||
| [Sentry Spotlight](https://spotlightjs.com/) is a local development tool that provides real-time observability for errors, traces, logs, and performance data during development. It allows you to see Sentry events in real-time without sending them to Sentry's servers, making it perfect for local debugging. | ||
|
|
||
| To set up Spotlight, follow the [Spotlight setup guide](https://spotlightjs.com/). Once Spotlight is running, you can enable the integration in your Capacitor app. | ||
|
|
||
| ### Usage | ||
|
|
||
| The `spotlightIntegration` sends a copy of all Sentry events to your local Spotlight instance during development. This allows you to debug issues locally with full visibility into errors, transactions, and other telemetry data. | ||
|
|
||
| ```javascript diff | ||
| import * as Sentry from '@sentry/capacitor'; | ||
|
|
||
| Sentry.init({ | ||
| + integrations: [ | ||
| + Sentry.spotlightIntegration({ | ||
| + sidecarUrl: 'IP:PORT/stream' //Only required when testing outside of a browser. | ||
| + }), | ||
| ] | ||
| }, siblingSdk); | ||
|
|
||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,108 @@ | ||||||
| --- | ||||||
| title: Migrate from 2.x to 3.x | ||||||
| sidebar_order: 7919 | ||||||
| description: "Learn about migrating from Sentry Capacitor SDK 2.x to 3.x" | ||||||
| --- | ||||||
|
|
||||||
| <Alert level="warning" title="Important"> | ||||||
|
|
||||||
|
|
||||||
| Version 3 is still under development, this documentation may change before the final release. | ||||||
|
|
||||||
|
|
||||||
| </Alert> | ||||||
|
|
||||||
| Version 3 of the Sentry Capacitor SDK primarily introduces API cleanup and version support changes. | ||||||
|
|
||||||
| The main goal of version 3 of Sentry Capacitor SDK is to provide compatibility with Sentry JavaScript version 10. This update includes breaking changes due to the upgrade to JavaScript SDK v10, the removal of deprecated APIs, reorganization of the npm package structure and also the refactoring on how you initialize Sentry Capacitor. | ||||||
|
|
||||||
|
|
||||||
| ## Major Changes in Sentry JS SDK v10 | ||||||
|
|
||||||
| This update contains API cleanups related to `BaseClient`, `hasTracingEnabled`, and `logger` from `@sentry/core`. For details and other general JavaScript SDK version 10 changes. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a little unclear to me, after "For details and other general JavaScript SDK version 10 changes." should there be some details provided? |
||||||
| Each Sibling SDK has specific changes in version 10, follow the tutorials below to update the SDK. | ||||||
|
|
||||||
| - [Angular SDK 8.x to 9.x migration guide](/platforms/javascript/guides/angular/migration/v9-to-v10/). | ||||||
| - [React SDK 8.x to 9.x migration guide](/platforms/javascript/guides/react/migration/v9-to-v10/). | ||||||
| - [Vue SDK 8.x to 9.x migration guide](/platforms/javascript/guides/vue/migration/v9-to-v10/). | ||||||
| - [Nuxt SDK 8.x to 9.x migration guide](/platforms/javascript/guides/nuxt/migration/v9-to-v10/). | ||||||
|
|
||||||
| ## Important Capacitor SDK `3.x` changes | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| This section describes the changes in Sentry Capacitor SDK, version 3. | ||||||
|
|
||||||
| ### Changes on how you initialize the SDK on projects using Vue or Nuxt. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Starting on version `3.0.0`, calling `sentry.init` will break, to fix it, you will need to move the `sibling` parameters from the root option to `siblingOptions` inside the root of `CapacitorOptions`. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```JavaScript diff {tabTitle: Vue} | ||||||
| import * as Sentry from '@sentry/capacitor'; | ||||||
| import * as SentryVue from '@sentry/vue'; | ||||||
|
|
||||||
| Sentry.init({ | ||||||
| - app: app, | ||||||
| attachErrorHandler: false, | ||||||
| dsn: '...', | ||||||
| enableLogs: true, | ||||||
| - attachErrorHandler: false, | ||||||
| - attachProps: true, | ||||||
| - attachErrorHandler: true, | ||||||
| - tracingOptions: ... | ||||||
| + siblingOptions: { | ||||||
| + vueOptions: { | ||||||
| + app: app, | ||||||
| + attachErrorHandler: false, | ||||||
| + attachProps: true, | ||||||
| + attachErrorHandler: true, | ||||||
| + tracingOptions: ... | ||||||
| + }, | ||||||
| + }, | ||||||
| }, SentryVue.init); | ||||||
| ``` | ||||||
|
|
||||||
| ```JavaScript diff {tabTitle: Nuxt} | ||||||
| import * as Sentry from '@sentry/capacitor'; | ||||||
| import * as SentryNuxt from '@sentry/nuxt'; | ||||||
|
|
||||||
| Sentry.init({ | ||||||
| - Vue: Vue, | ||||||
| attachErrorHandler: false, | ||||||
| dsn: '...', | ||||||
| enableLogs: true, | ||||||
| - attachErrorHandler: false, | ||||||
| - attachProps: true, | ||||||
| - attachErrorHandler: true, | ||||||
| - tracingOptions: ... | ||||||
| + siblingOptions: { | ||||||
| + nuxtOptions: { | ||||||
| + Vue: Vue, | ||||||
| + attachErrorHandler: false, | ||||||
| + attachProps: true, | ||||||
| + attachErrorHandler: true, | ||||||
| + tracingOptions: ... | ||||||
| + }, | ||||||
| + }, | ||||||
| }, SentryNuxt.init); | ||||||
| ``` | ||||||
|
|
||||||
| ### Logs are out of experimental | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| to keep using logs, you need to move your parameters from `Options._experimental.*` into `Options.*`, the `_experimental` field was removed on version `3.0.0` but may return once new experimental fields appear. | ||||||
|
|
||||||
| ### Integration Changes | ||||||
|
|
||||||
| This version will include more integrations by default and also a new Spotlight integration that works on both Web and Mobile. See the list below with the new integrations: | ||||||
|
|
||||||
| | | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** | | ||||||
| |-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:| | ||||||
| | <PlatformLink to="/configuration/integrations/breadcrumbs/">`breadcrumbsIntegration`</PlatformLink> | ✓ | | | | ✓ | | ||||||
| | <PlatformLink to="/configuration/integrations/browserapierrors/">`browserApiErrorsIntegration`</PlatformLink> | ✓ | ✓ | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/dedupe/">`dedupeIntegration`</PlatformLink> | ✓ | ✓ | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/functiontostring/">`functionToStringIntegration`</PlatformLink> | ✓ | | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/globalhandlers/">`globalHandlersIntegration`</PlatformLink> | ✓ | ✓ | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/inboundfilters/">`inboundFiltersIntegration`</PlatformLink> | ✓ | ✓ | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/linkederrors/">`linkedErrorsIntegration`</PlatformLink> | ✓ | ✓ | | | | | ||||||
| | <PlatformLink to="/configuration/integrations/spotlight/">`spotlightIntegration`</PlatformLink> | | | | | | | ||||||
|
|
||||||
|
|
||||||
| <PageGrid/> | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The
Sentry.initexample inspotlight.mdxuses an undefinedsiblingSdkvariable, causing aReferenceError.Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The code example in
docs/platforms/javascript/guides/capacitor/configuration/integrations/spotlight.mdx(lines 18-28) uses an undefined variablesiblingSdkas the second argument toSentry.init. This variable is not declared or imported, leading to aReferenceError: siblingSdk is not definedat runtime if developers copy the example. This will cause application initialization to fail, as the example needs to specify a framework-specific SDK and its corresponding import.💡 Suggested Fix
Replace
siblingSdkwith a framework-specific Sentry SDK init function (e.g.,SentryVue.init) and add the corresponding import statement (e.g.,import * as SentryVue from '@sentry/vue';) to the code example.🤖 Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID:
6119133