Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 62 additions & 15 deletions docs/platforms/javascript/guides/capacitor/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,27 @@ This guide will show you setup instructions for Angular, React, Vue, and Nuxt. I

</Alert>

## Step 1: Install
<StepConnector selector="h2" showNumbers={true}>

## Install

### Install the Sentry SDK

<SplitLayout>
<SplitSection>
<SplitSectionText>

Run the command for your preferred package manager to add Sentry's Capacitor SDK and the SDK for the framework you're using to your application:

</SplitSectionText>
<SplitSectionCode>

<PlatformContent includePath="getting-started-install" />

</SplitSectionCode>
</SplitSection>
</SplitLayout>

<Expandable title="Notes on framework compatibility">

#### Angular
Expand All @@ -44,7 +57,7 @@ Both frameworks are fully compatible with the current and beta versions of Sentr

</Expandable>

## Step 2: Configure
## Configure

Choose the features you want to configure, and this guide will show you how:

Expand All @@ -62,27 +75,51 @@ Choose the features you want to configure, and this guide will show you how:

### Initialize the Sentry SDK

<SplitLayout>
<SplitSection>
<SplitSectionText>

Initialize Sentry as early as possible in your application's lifecycle.

If you're using Angular, React, Vue, or Nuxt, make sure to forward the `init` method from the framework's Sentry SDK, as you can see in these code snippets. If you're following the vanilla setup, you don't need to do this.

</SplitSectionText>
<SplitSectionCode>

<PlatformContent includePath="getting-started-config" />

## Step 3: Add Readable Stack Traces With Source Maps (Optional)
</SplitSectionCode>
</SplitSection>
</SplitLayout>

<PlatformContent includePath="getting-started-sourcemaps-short-version" />
### Add Readable Stack Traces With Source Maps (Optional)

## Step 4: Provide Native Debug Information for iOS (Optional)
<PlatformContent includePath="getting-started-sourcemaps-short-version-splitlayout" />

### Provide Native Debug Information for iOS (Optional)

You need to provide debug information to Sentry to make the stack-trace information for native crashes on iOS easier to understand. You can provide debug information by [uploading dSYM files](/platforms/javascript/guides/capacitor/dsym).

## Step 5: Verify
## Verify

Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.

### Issues

To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button and logic:
<SplitLayout>
<SplitSection>
<SplitSectionText>

To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button and logic.

<OnboardingOption optionId="performance" hideForThisOption>
Open the page in a browser and click the button to trigger a frontend error.
</OnboardingOption>

<PlatformContent includePath="getting-started-browser-sandbox-warning" />

</SplitSectionText>
<SplitSectionCode>

```javascript {tabTitle: Angular 12, 13, 14+}
@Component({
Expand Down Expand Up @@ -147,17 +184,23 @@ export default {
</script>
```

<OnboardingOption optionId="performance" hideForThisOption>
Open the page in a browser and click the button to trigger a frontend error.
</OnboardingOption>

<PlatformContent includePath="getting-started-browser-sandbox-warning" />
</SplitSectionCode>
</SplitSection>
</SplitLayout>

<OnboardingOption optionId="performance">

### Tracing

To test your tracing configuration, update the previous code snippet and wrap the error in a custom span:
<SplitLayout>
<SplitSection>
<SplitSectionText>

To test your tracing configuration, update the previous code snippet and wrap the error in a custom span.
Then, open the page in a browser and click the button to trigger a frontend error and trace.

</SplitSectionText>
<SplitSectionCode>

```javascript {tabTitle: Angular 12, 13, 14+}
import * as Sentry from "@sentry/capacitor";
Expand Down Expand Up @@ -246,13 +289,15 @@ export default {
</script>
```

Open the page in a browser and click the button to trigger a frontend error and trace.
</SplitSectionCode>
</SplitSection>
</SplitLayout>

</OnboardingOption>

<OnboardingOption optionId="logs">

<Include name="logs/javascript-quick-start-verify-logs" />
<Include name="logs/javascript-quick-start-verify-logs-splitlayout" />

</OnboardingOption>

Expand All @@ -279,3 +324,5 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
- [Get support](https://sentry.zendesk.com/hc/en-us/)

</Expandable>

</StepConnector>
68 changes: 60 additions & 8 deletions docs/platforms/javascript/guides/cordova/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ categories:
---

<Alert level="warning" title="Deprecation Notice">
Cordova is being superseded by modern alternatives like [Capacitor](https://ionic.io/resources/articles/capacitor-vs-cordova-modern-hybrid-app-development). This SDK is no longer maintained by Sentry. If you are starting a new project or planning a [migration](https://capacitorjs.com/docs/cordova/migration-strategy), consider using [Sentry Capacitor](/platforms/javascript/guides/capacitor/), [Sentry React Native](/platforms/react-native/), or [Sentry Flutter](/platforms/flutter/) instead.

Cordova is being superseded by modern alternatives like [Capacitor](https://ionic.io/resources/articles/capacitor-vs-cordova-modern-hybrid-app-development).
This SDK is no longer maintained by Sentry. If you are starting a new project or planning a [migration](https://capacitorjs.com/docs/cordova/migration-strategy), consider
using [Sentry Capacitor](/platforms/javascript/guides/capacitor/), [Sentry React Native](/platforms/react-native/), or [Sentry Flutter](/platforms/flutter/) instead.

</Alert>

<Alert>
Expand All @@ -35,15 +39,17 @@ Cordova is being superseded by modern alternatives like [Capacitor](https://ioni

<PlatformContent includePath="getting-started-prerequisites" />

## Step 1: Install
<StepConnector selector="h2" showNumbers={true}>

## Install

### Install the Sentry SDK

Run this `cordova` command to add the Sentry SDK to your application:
<SplitLayout>
<SplitSection>
<SplitSectionText>

```bash
cordova plugin add sentry-cordova
```
Run this `cordova` command to add the Sentry SDK to your application:

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:
Expand All @@ -52,12 +58,30 @@ The wizard helps configure your project by:
- 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

## Step 2: Configure
</SplitSectionText>
<SplitSectionCode>

```bash
cordova plugin add sentry-cordova
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>

## Configure

### Initialize the Sentry SDK

<SplitLayout>
<SplitSection>
<SplitSectionText>

Initialize Sentry as early as possible in your application. For this, `init` the SDK in the `deviceready` event:

</SplitSectionText>
<SplitSectionCode>

```javascript
onDeviceReady: function() {
var Sentry = cordova.require("sentry-cordova.Sentry");
Expand All @@ -71,22 +95,48 @@ onDeviceReady: function() {
}
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>

### Allow the Sentry Domain

<SplitLayout>
<SplitSection>
<SplitSectionText>

Make sure your app can talk to Sentry by adding this to your `config.xml`:

</SplitSectionText>
<SplitSectionCode>

```xml {filename:config.xml}
<access origin="https://*.sentry.io" />
```

## Step 3: Verify Your Setup
</SplitSectionCode>
</SplitSection>
</SplitLayout>

## Verify Your Setup

Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.

<SplitLayout>
<SplitSection>
<SplitSectionText>

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.

</SplitSectionText>
<SplitSectionCode>

<PlatformContent includePath="getting-started-verify" />

</SplitSectionCode>
</SplitSection>
</SplitLayout>

### View Captured Data in Sentry

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.
Expand All @@ -108,3 +158,5 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
- [Get support](https://sentry.zendesk.com/hc/en-us/)

</Expandable>

</StepConnector>
Loading
Loading