Configuration

To get started, you need to configure Raven to use your Sentry DSN:

var Raven = require('raven');
Raven.config('___PUBLIC_DSN___').install()

At this point, Raven is ready to capture any uncaught exceptions.

Optional settings

Raven.config() can optionally be passed an additional argument for extra configuration:

Raven.config('___PUBLIC_DSN___', {
    release: '1.3.0'
}).install()

Those configuration options are documented below:

logger

The name of the logger used by Sentry. Default: ''

{
  logger: 'default'
}
release

Track the version of your application in Sentry.

{
  release: '721e41770371db95eee98ca2707686226b993eda'
}
environment

Track the environment name inside Sentry.

{
  environment: 'staging'
}
tags

Additional tags to assign to each event.

{
  tags: {git_commit: 'c0deb10c4'}
}
extra

Arbitrary data to associate with the event.

{
    extra: {planet: {name: 'Earth'}}
}
dataCallback

A function that allows mutation of the data payload right before being sent to Sentry.

{
    dataCallback: function(data) {
        // add a user context
        data.user = {
            id: 1337,
            name: 'janedoe',
            email: 'janedoe@example.com'
        };
        return data;
    }
}
shouldSendCallback

A callback function that allows you to apply your own filters to determine if the event should be sent to Sentry.

{
    shouldSendCallback: function (data) {
        // randomly omit half of events
        return Math.random() > 0.5;
    }
}
autoBreadcrumbs

Enables/disables automatic collection of breadcrumbs. Possible values are:

  • false - all automatic breadcrumb collection disabled (default)
  • true - all automatic breadcrumb collection enabled
  • A dictionary of individual breadcrumb types that can be enabled/disabled:
autoBreadcrumbs: {
    'console': false,  // console logging
    'http': true,     // http and https requests
    'pg': true,  // postgresql queries from pg module
}
maxBreadcrumbs

Raven captures up to 30 breadcrumb entries by default. You can increase this to be as high as 100, or reduce it if you find 30 is too noisy, by setting maxBreadcrumbs.

Note that in very high-concurrency situations where you might have a large number of long-lived contexts each with a large number of associated breadcrumbs, there is potential for significant memory usage. 10,000 contexts with 10kB of breadcrumb data each will use around 120mB of memory. Most applications will be nowhere close to either of these numbers, but if yours might be, you can use the maxBreadcrumbs parameter to limit the amount of breadcrumb data each context will keep around.

transport

Override the default HTTP data transport handler.

{
    transport: function (options) {
        // send data
    }
}

Please see the raven-node source code to see how transports are implemented.

Environment Variables

SENTRY_DSN

Optionally declare the DSN to use for the client through the environment. Initializing the client in your app won’t require setting the DSN.

SENTRY_NAME

Optionally set the name for the client to use. What is name?

SENTRY_RELEASE

Optionally set the application release version for the client to use, this is usually a Git SHA hash.

SENTRY_ENVIRONMENT

Optionally set the environment name, e.g. “staging”, “production”.