HttpClient

This integration captures errors on failed requests from Fetch and XHR and attaches request and response information.

By default, error events don't contain header or cookie data. You can change this behavior by setting sendDefaultPii: true in your root Sentry.init({}) config.

This integration requires you to install @sentry/integrations next to your main SDK package.

Copied
import * as Sentry from "@sentry/browser";
import { httpClientIntegration } from "@sentry/integrations";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [httpClientIntegration()]

  // This option is required for capturing headers and cookies.
  sendDefaultPii: true,
});

Type: (number|[number, number])[]

This array can contain tuples of [begin, end] (both inclusive), single status codes, or a combination of the two. Default: [[500, 599]]

Type: (string|RegExp)[]

An array of request targets that should be considered, for example ['http://example.com/api/test'] would interpret any request to this URL as a failure. This array can contain Regexes, strings, or a combination of the two. Default: [/.*/]

Type: boolean

This option is required for capturing headers and cookies.

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").