-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
docs(js): Cordova quick start guide *quick* update #16363
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
inventarSarah
wants to merge
2
commits into
master
Choose a base branch
from
smi/quick-start/cordova
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.
+79
−75
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
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 | ||||
|---|---|---|---|---|---|---|
| @@ -1,40 +1,105 @@ | ||||||
| --- | ||||||
| title: Cordova | ||||||
| sdk: sentry.javascript.cordova | ||||||
| description: Learn how to manually set up Sentry in your Cordova app and capture your first errors. | ||||||
| categories: | ||||||
| - javascript | ||||||
| - browser | ||||||
| - mobile | ||||||
| --- | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-primer" /> | ||||||
| <Alert> | ||||||
| The Cordova SDK uses a native extension for iOS and Android, but will fall | ||||||
| back to a pure JavaScript version (`@sentry/browser`) if needed. | ||||||
| </Alert> | ||||||
|
|
||||||
| <Expandable title="Features"> | ||||||
|
|
||||||
| - Automatic Native crash [error tracking](/product/issues/) using both [iOS](/platforms/apple/guides/ios/) and [Android](/platforms/android/) supports | ||||||
| - [Release health](/product/releases/health/) to track crash-free users and sessions | ||||||
| - Offline storage of events | ||||||
| - Android: Offline caching when a device is offline; we send a report once the application is restarted | ||||||
| - iOS: Offline caching when a device is unable to connect; we send a report once we receive another event | ||||||
| - Events [enriched](/platforms/javascript/guides/cordova/enriching-events/context/) with device data | ||||||
| - [Breadcrumbs](/platforms/javascript/guides/cordova/enriching-events/breadcrumbs/) created for location changes, outgoing HTTP requests with XHR and Fetch, console logs, and HTML touch events | ||||||
| - On-device symbolication for JavaScript (in `Debug` mode) | ||||||
| - [Ionic support](/platforms/javascript/guides/cordova/ionic/) | ||||||
| - Under the hood, the SDK relies on our [JavaScript SDK](/platforms/javascript/), which makes all functions available for JavaScript also available in this SDK ,including: | ||||||
| - [Tracing](/platforms/javascript/guides/cordova/performance/instrumentation/custom-instrumentation) to create transactions | ||||||
|
|
||||||
| </Expandable> | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-prerequisites" /> | ||||||
|
|
||||||
| ## Step 1: Install | ||||||
|
|
||||||
| ### Install the Sentry SDK | ||||||
|
|
||||||
| Run this `cordova` command to add the Sentry SDK to your application: | ||||||
|
|
||||||
| ```bash | ||||||
| cordova plugin add sentry-cordova | ||||||
| ``` | ||||||
|
|
||||||
| ## Install | ||||||
| This command starts the Sentry Wizard, which will patch your project (you need to do this only once). | ||||||
| The wizard helps configure your project by: | ||||||
|
|
||||||
| Sentry captures data by using an SDK within your application’s runtime. | ||||||
| - Linking your Sentry account and project | ||||||
| - Adding a build step to Xcode to upload debug symbols for iOS crashes | ||||||
| - Configuring <PlatformLink to="/sourcemaps">source map uploads</PlatformLink> so you can see your original JavaScript code in Sentry instead of minified production code | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-install" /> | ||||||
| ## Step 2: Configure | ||||||
|
|
||||||
| ## Configure | ||||||
| ### Initialize the Sentry SDK | ||||||
|
|
||||||
| Configuration should happen as early as possible in your application's lifecycle. | ||||||
| Initialize Sentry as early as possible in your application. For this, `init` the SDK in the `deviceready` event: | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-config" /> | ||||||
| ```javascript | ||||||
| onDeviceReady: function() { | ||||||
| var Sentry = cordova.require("sentry-cordova.Sentry"); | ||||||
| Sentry.init({ | ||||||
| dsn: '___PUBLIC_DSN___', | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-sourcemaps" /> | ||||||
| // Adds request headers and IP for users, for more info visit: | ||||||
| // https://docs.sentry.io/platforms/javascript/guides/cordova/configuration/options/#sendDefaultPii | ||||||
| sendDefaultPii: true, | ||||||
| }); | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Verify | ||||||
| ### Allow Sentry Domain | ||||||
|
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
|
||||||
|
|
||||||
| Make sure your app can talk to Sentry by adding this to your `config.xml`: | ||||||
|
|
||||||
| ```xml {filename:config.xml} | ||||||
| <access origin="https://*.sentry.io" /> | ||||||
| ``` | ||||||
|
|
||||||
| ## Step 3: Verify Your Setup | ||||||
|
|
||||||
| Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project. | ||||||
|
|
||||||
| This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-verify" /> | ||||||
|
|
||||||
| <Alert> | ||||||
| ### View Captured Data in Sentry | ||||||
|
|
||||||
| Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>. | ||||||
| To view and resolve the recorded error, log in to [sentry.io](https://sentry.io) and select your project. Clicking the error's title opens a page where you can view detailed information and mark it as resolved. | ||||||
|
|
||||||
| </Alert> | ||||||
| ## Next Steps | ||||||
|
|
||||||
| At this point, you should have integrated Sentry into your Cordova application and should already be sending data to your Sentry project. | ||||||
|
|
||||||
| Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are: | ||||||
|
|
||||||
| - Continue to <PlatformLink to="/configuration">customize your configuration</PlatformLink> | ||||||
| - Learn how to <PlatformLink to="/upload-debug">upload debug symbols</PlatformLink> to make sure your native stack traces are readable | ||||||
| - Check our [Ionic support guide](/platforms/javascript/guides/cordova/ionic/) | ||||||
| - Learn how to <PlatformLink to="/usage">manually capture errors</PlatformLink> | ||||||
|
|
||||||
| To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. | ||||||
| <Expandable permalink={false} title="Are you having problems setting up the SDK?"> | ||||||
| - If you are experiencing errors and want to remove unused architectures from your binary when submitting the build to iTunes Connect, you can use the scripts provided in [Troubleshooting](/platforms/javascript/guides/cordova/troubleshooting/). | ||||||
| - [Get support](https://sentry.zendesk.com/hc/en-us/) | ||||||
|
|
||||||
| <PlatformContent includePath="getting-started-next-steps" /> | ||||||
| </Expandable> | ||||||
29 changes: 0 additions & 29 deletions
29
platform-includes/getting-started-config/javascript.cordova.mdx
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
platform-includes/getting-started-install/javascript.cordova.mdx
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
platform-includes/getting-started-primer/javascript.cordova.mdx
This file was deleted.
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.