Default Integrations

System integrations are enabled by default to integrate into the standard library or the interpreter itself. They're documented so you can understand what they do and disable them if they cause issues.

Import name: Sentry.inboundFiltersIntegration

This integration allows you to ignore specific errors based on the error message or the URL from which the exception originated.

To configure it, use the ignoreErrors, ignoreTransactions, denyUrls, and allowUrls SDK options directly. Keep in mind that denyUrls and allowUrls only work for captured exceptions, not raw message events.

Import name: Sentry.functionToStringIntegration

This integration allows the SDK to provide original function and method names, even when those functions or methods are wrapped by our error or breadcrumb handlers.

Import name: Sentry.linkedErrorsIntegration

This integration allows you to configure linked errors. They'll be recursively read up to a specified limit, and a lookup will be performed by a specific key on the captured Error object. By default, the integration records up to five errors and the key used for recursion is "cause".

This integration also enhances captured error events with data from an AggregateError where applicable, by recursively iterating over the errors property on Error objects.

Available options:

Copied
{
  key: string; // default: "cause"
  limit: number; // default: 5
}

Import name: Sentry.consoleIntegration

This integration wraps the console module to record all of its calls as breadcrumbs.

Import name: Sentry.httpIntegration

This integration wraps the http and https modules to capture all outgoing network requests as breadcrumbs and/or tracing spans.

Available options:

Copied
{
  breadcrumbs: boolean; // default: true
  tracing: boolean | TracingOptions; // default: false
}

Where TracingOptions is:

Copied
{
  /**
   * List of strings/regex controlling to which outgoing requests
   * the SDK will attach tracing headers.
   *
   * By default the SDK will attach those headers to all outgoing
   * requests. If this option is provided, the SDK will match the
   * request URL of outgoing requests against the items in this
   * array, and only attach tracing headers if a match was found.
   */
  tracePropagationTargets?: TracePropagationTargets;

  /**
   * Function determining whether or not to create spans to track outgoing requests to the given URL.
   * By default, spans will be created for all outgoing requests.
   */
  shouldCreateSpanForRequest?: (url: string) => boolean;
}

(New in version 7.46.0)

Import name: nativeNodeFetchIntegration

Instruments outgoing HTTP requests made with undici and Node 18's Node Fetch by adding breadcrumbs and spans.

Supports Undici v4.7.0 or higher and requires Node v16.7.0 or higher. There have been reported issues with Node.js v19 and the Undici integration so we recommend you use an LTS version of Node.js with this integration.

Available options:

Copied
{
  /**
   * If breadcrumbs should be created for outgoing requests.
   * Defaults to true.
   */
  breadcrumbs?: boolean;
  /**
   * Function determining whether or not to create spans to track outgoing requests to the given URL.
   * By default, spans will be created for all outgoing requests.
   */
  shouldCreateSpanForRequest?: (url: string) => boolean;
}

To change what requests get the sentry-trace and baggage headers attached (for use in distributed tracing), use the top-level tracePropagationTargets option.

Copied
Sentry.init({
  tracePropagationTargets: ["my-site-url.com"],
});

Import name: Sentry.onUncaughtExceptionIntegration

This integration attaches a global uncaught exception handler. It can be modified to provide a custom shutdown function. The onFatalError option is meant to perform a cleanup before the process exits, not fully prevent it from exiting.

Available options:

Copied
{
  onFatalError: (firstError: Error, secondError?: Error) => void;
}

Import name: Sentry.onUnhandledRejectionIntegration

This integration attaches a global unhandled rejection handler. By default, all unhandled rejections trigger a warning and log the error. You can change this behavior using the mode option, which works with Node's CLI options: https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode.

Available options:

Copied
{
  mode: "none" | "warn" | "strict"; // default: "warn"
}

Import name: Sentry.contextLinesIntegration

(Available in version 6.18.0 and above)

This integration adds source file context to stack frames for captured exceptions.

Available options:

Copied
{
  // The number of context lines to include with each frame
  frameContextLines: number;
}

Import name: Sentry.localVariablesIntegration

(Available in version 7.46.0 and above)

This integration adds stack local variables to stack frames for uncaught exceptions. Only works with Node 18+.

To enable this integration, set the includeLocalVariables init option to true.

Available options:

Copied
{
  // Capture local variables for both handled and unhandled exceptions.
  // Default: false - Only captures local variables for uncaught exceptions.
  captureAllExceptions?: boolean;
}

(New in version 7.13.0.)

Import name: Sentry.modulesIntegration

This integration fetches names of all currently installed Node modules and attaches the list to the event. Once fetched, Sentry will cache the list for later reuse.

(New in version 7.17.1.)

Import name: Sentry.requestDataIntegration

This integration adds data from incoming requests to transaction and error events that occur during request handling.

Available options:

Copied
{
  // Controls what types of data are added to the event
  include: {
    cookies: boolean  // default: true,
    data: boolean  // default: true,
    headers: boolean  // default: true,
    ip: boolean  // default: false,
    query_string: boolean  // default: true,
    url: boolean  // default: true,
    user: boolean | {
      id: boolean  // default: true,
      username: boolean  // default: true,
      email: boolean  // default: true,
    },
  },
  // Controls how the transaction will be reported. Options are 'path' (`/some/route`),
  // 'methodPath' (`GET /some/route`), and 'handler' (the name of the route handler
  // function, if available)
  transactionNamingScheme: string  // default: 'methodPath',
};

To disable system integrations, set defaultIntegrations: false when calling init().

To override an integration's settings, provide a new instance to the integrations option when calling init(). For example, to change the fatal error handler:

Copied
Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [
    Sentry.onUncaughtExceptionIntegration({
      onFatalError: () => {
        // your implementation
      },
    }),
  ],
});

This example removes the default-enabled Console integration:

Copied
Sentry.init({
  // ...

  integrations: function (integrations) {
    // integrations will be all default integrations
    return integrations.filter((integration) => integration.name !== "Console");
  },
});
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").