-
-
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
Open
lucas-zimerman
wants to merge
2
commits into
master
Choose a base branch
from
lz/cap-v3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+137
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
.../platforms/javascript/guides/capacitor/configuration/integrations/spotlight.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
|
|
||
| ``` | ||
108 changes: 108 additions & 0 deletions
108
docs/platforms/javascript/guides/capacitor/migration/v2-to-v3/index.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
| 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 | ||
|
|
||
| This section describes the changes in Sentry Capacitor SDK, version 3. | ||
|
|
||
| ### Changes on how you initialize the SDK on projects using Vue or Nuxt. | ||
|
|
||
| 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`. | ||
|
|
||
| ```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 | ||
|
|
||
| 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/> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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