Getting Started

For an overview of what Sentry does, take a look at the Sentry workflow.

Sentry is designed to be very simple to get off the ground, yet powerful to grow into. If you have never used Sentry before, this tutorial will help you getting started.

Getting started with Sentry is a three step process:

  1. Sign up for an account
  2. Install your SDK
  3. Configure it

Install an SDK

Sentry captures data by using an SDK within your application’s runtime. These are platform specific and allow Sentry to have a deep understanding of both how your application works. In case your environment is very specific, you can also roll your own SDK using our document SDK API.

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/node@4.6.1

Or alternatively you can npm install it:

$ npm install @sentry/node@4.6.1

Install our Python SDK using pip:

$ pip install --upgrade sentry-sdk==0.7.2

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/browser@4.6.1

Or alternatively you can npm install it:

$ npm install @sentry/browser@4.6.1

To add Sentry to your Rust project you just need to add a new dependency to your Cargo.toml:

sentry = "0.12.0"

Install the NuGet package:

Package Manager:

Install-Package Sentry.AspNetCore -Version 1.1.2

.NET Core CLI:

dotnet add package Sentry.AspNetCore -v 1.1.2

To install the SDK you will need to be using Composer in your project. To install it please see the docs.

Sentry PHP is not tied to any specific library that sends HTTP messages. Instead, it uses Httplug to let users choose whichever PSR-7 implementation and HTTP client they want to use.

If you just want to get started quickly you should run the following command:

php composer.phar require sentry/sentry:2.0.0-beta2 php-http/curl-client guzzlehttp/psr7

This will install the library itself along with an HTTP client adapter that uses cURL as transport method (provided by Httplug) and a PSR-7 implementation (provided by Guzzle). You do not have to use those packages if you do not want to. The SDK does not care about which transport method you want to use because it’s an implementation detail of your application. You may use any package that provides php-http/async-client-implementation and http-message-implementation.

If you want to use Guzzle as an underlying HTTP client, you just need to run the following command to install the adapter and Guzzle itself:

php composer.phar require php-http/guzzle6-adapter

Install the NuGet package:

Package Manager:

Install-Package Sentry -Version 1.1.2

.NET Core CLI:

dotnet add package Sentry -v 1.1.2

Install our SDK using the cordova command:

$ cordova plugin add sentry-cordova@0.12.3

If you are using yarn you can add our package as a dependency easily:

$ yarn add @sentry/electron@0.15.0

Or alternatively you can npm install it:

$ npm install @sentry/electron@0.15.0

The quickest way to get started is to use the CDN hosted version of the JavaScript browser SDK:

<script src="" crossorigin="anonymous"></script>

Configure the SDK

After you completed setting up a project in Sentry, you’ll be given a value which we call a DSN, or Data Source Name. It looks a lot like a standard URL, but it’s actually just a representation of the configuration required by the Sentry SDKs. It consists of a few pieces, including the protocol, public key, the server address, and the project identifier.

You need to inform the Sentry Node SDK about your DSN:

const Sentry = require('@sentry/node');
Sentry.init({ dsn: '___PUBLIC_DSN___' });
import sentry_sdk

You should init the Sentry browser SDK as soon as possible during your application load up:

import * as Sentry from '@sentry/browser';

Sentry.init({ dsn: '___PUBLIC_DSN___' });
extern crate sentry;
let _guard = sentry::init("___PUBLIC_DSN___");

Add Sentry to Program.cs through the WebHostBuilder:

public static IWebHost BuildWebHost(string[] args) =>
        // Add this:

To capture all errors, even the one during the startup of your application, you should initialize the Sentry PHP SDK as soon as possible.

\Sentry\init(['dsn' => '___PUBLIC_DSN___' ]);

You should initialize the SDK as early as possible, like in the Main method in Program.cs:

using (SentrySdk.Init("___PUBLIC_DSN___"))
    // App code

You should init the SDK in the deviceReady function, to make sure the native integrations runs. For more details about Cordova click here

onDeviceReady: function() {
  var Sentry = cordova.require("sentry-cordova.Sentry");
  Sentry.init({ dsn: '___PUBLIC_DSN___' });

You need to call init in your main and every renderer process you spawn. For more details about Electron click here

import * as Sentry from '@sentry/electron';

Sentry.init({dsn: '___PUBLIC_DSN___'});

You should init the Sentry Browser SDK as soon as possible during your page load:

Sentry.init({ dsn: '___PUBLIC_DSN___' });

Most SDKs will now automatically collect data if available, some require some extra configuration as automatic error collecting is not available due to platform limitations.

Next Steps

Now that you’ve got basic reporting setup, you’ll want to explore adding additional context to your data.