ContextLines

Import name: Sentry.contextLinesIntegration

This integration adds source code from inline JavaScript of the current page's HTML (e.g. JS in <script> tags) to stack traces of captured errors. It can't collect source code from assets referenced by your HTML (e.g. <script src="..." />).

The ContextLines integration is useful when you have inline JS code in HTML pages that can't be accessed by Sentry's backend, for example, due to a login-protected page.

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

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

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

Type: number

The number of lines to collect around each stack frame's line number. Defaults to 7.

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