Sentry-react-native: Disabling xhr autobreadcrumbs not available anymore in 1.0.0-beta.5

Created on 20 Aug 2019  ·  1Comment  ·  Source: getsentry/sentry-react-native

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

_Platform:_

  • [x] iOS
  • [x] Android

Output of node -v && npm -v && npm ls --prod --depth=0

v11.9.0
6.5.0
[email protected] /Users/app
├── @react-native-community/[email protected]
├── @react-native-community/[email protected]
├── @sentry/[email protected]
├── @turf/[email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET PEER DEPENDENCY [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Config:

Sentry.init({
      defaultIntegrations: [
        new ReactNativeErrorHandlers(),
        new Release(),
        ...defaultIntegrations.filter(
          i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name),
        ),
        new Integrations.Breadcrumbs({
          console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
          fetch: false,
          xhr: false, // This is the only change to the sentry original code, here we turn off automatic xhr tracking
        }),
        new DebugSymbolicator(),
        new RewriteFrames({
          iteratee: (frame: StackFrame) => {
            if (frame.filename) {
              frame.filename = frame.filename
                .replace(/^file\:\/\//, '')
                .replace(/^address at /, '')
                .replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, '');

              const appPrefix = 'app://';
              // We always want to have a triple slash
              frame.filename =
                frame.filename.indexOf('/') === 0
                  ? `${appPrefix}${frame.filename}`
                  : `${appPrefix}/${frame.filename}`;
            }
            return frame;
          },
        }),
        new DeviceContext(),
      ],
      dsn: SENTRY_DNS,
    });

I have following issue:

I would like to be able to disable automatic breadcrumbs/tracking of the http requests.
In the older Sentry, let say 0.39.0, there was an option autoBreadcrumbs: false. This setting is not available any more. The only way I found to get similar results is to copy&paste almost the whole content of sdk.ts https://github.com/getsentry/sentry-react-native/blob/master/src/js/sdk.ts#L28, just to add one line xhr: false in line 44 :/

It would be great to be able to provide my own settings without overwriting ALL of your default settings. Right now it is: take all settings without a change or provide everything not matter you want to change them or not.

Most helpful comment

I just released 1.0.3 exposing BrowserIntegrations that should make this more easy.
You can just do

Sentry.init({
  ...
  integrations: [
    new Sentry.BrowserIntegrations.Breadcrumbs({
      console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
      fetch: false,
      xhr: false
    })
  ]
});

hope this helps.

>All comments

I just released 1.0.3 exposing BrowserIntegrations that should make this more easy.
You can just do

Sentry.init({
  ...
  integrations: [
    new Sentry.BrowserIntegrations.Breadcrumbs({
      console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
      fetch: false,
      xhr: false
    })
  ]
});

hope this helps.

Was this page helpful?
0 / 5 - 0 ratings