Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

README.md

Outline

Sentry

Legacy Sentry SDK for NodeJS

npm version npm dm npm dt

Links

Status

Since v8, this is the legacy SDK, and it will most likely be completely removed before v8 is fully stable. It only exists so that Meta-SDKs like @sentry/nextjs or @sentry/sveltekit can be migrated to the new @sentry/node step-by-step.

You should instead use @sentry/node.

Usage

To use this SDK, call init(options) as early as possible in the main entry module. This will initialize the SDK and hook into the environment. Note that you can turn off almost all side effects using the respective options. Minimum supported Node version is Node 14.

// CJS syntax
const Sentry = require('@sentry/node-experimental');
// ESM syntax
import * as Sentry from '@sentry/node-experimental';

Sentry.init({
  dsn: '__DSN__',
  // ...
});

To set context information or send manual events, use the exported functions of @sentry/node-experimental. Note that these functions will not perform any action before you have called init():

// Set user information, as well as tags and further extras
Sentry.setExtra('battery', 0.7);
Sentry.setTag('user_mode', 'admin');
Sentry.setUser({ id: '4711' });

// Add a breadcrumb for future events
Sentry.addBreadcrumb({
  message: 'My Breadcrumb',
  // ...
});

// Capture exceptions, messages or manual events
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
  message: 'Manual',
  stacktrace: [
    // ...
  ],
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.