RewriteFrames

Import name: Sentry.rewriteFramesIntegration

This integration allows you to apply a transformation to each frame of the stack trace. In the streamlined scenario, it can be used to change the name of the file frame it originates from, or it can be fed with an iterated function to apply any arbitrary transformation.

On Windows machines, you have to use Unix paths and skip the volume letter in the root option to enable it. For example, C:\\Program Files\\Apache\\www won’t work, however, /Program Files/Apache/www will.

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

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

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

Type: string

Root path that will be stripped from the current frame's filename by the default iteratee if the filename is an absolute path.

Type: string

A custom prefix that will be used by the default iteratee. Default: app://

Type: (frame) => frame

Function that takes the frame, applies a transformation, and returns it.

For example, if the full path to your file is /www/src/app/file.js:

UsagePath in Stack TraceDescription
RewriteFrames()app:///file.jsThe default behavior is to replace the absolute path, except the filename, and prefix it with the default prefix (app:///).
RewriteFrames({prefix: 'foo/'})foo/file.jsPrefix foo/ is used instead of the default prefix app:///.
RewriteFrames({root: '/www'})app:///src/app/file.jsroot is defined as /www, so only that part is trimmed from the beginning of the path.
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").