Sentry-react-native: Docs for using the 1.0.0 version?

Created on 29 Aug 2019  路  3Comments  路  Source: getsentry/sentry-react-native

Question:

I am migrating from the 0.x.x versions of react-native-sentry to @sentry/react-native (1.0.0) and I am not sure how exactly to complete the upgrade. The methods have changed and the docs still describe the older version for react native.

Is there an upgrade guide? None of my errors are sending anymore even though I've scowered the internet for implementation examples using Sentry.init (formally Sentry.config) with Sentry.addGlobalEventProcessor in a redux compose middleware.

If not - is there an expected timeline for when the docs will reflect the new release?

Most helpful comment

@anka-213 Sorry about this, you can just do

Sentry.setTags({
    appVersion: DeviceInfo.getVersion(),
    buildNumber: DeviceInfo.getBuildNumber(),
}),
Sentry.setContexts('deviceInfo', {
      systemName: DeviceInfo.getSystemName(),
      systemVersion: DeviceInfo.getSystemVersion(),
      deviceName: DeviceInfo.getDeviceName(),
    });

All 3 comments

The docs have been updated following the 1.0.0 release of the new SDK

https://docs.sentry.io/platforms/react-native/

If anything important is missing, please point it out.

@HazAT I think one major thing that is missing is a translation table for what the corresponding functions in the new library is for the functions in the old library. For example, the following code:

import {Sentry} from 'react-native-sentry'
import DeviceInfo from 'react-native-device-info'

Sentry.config("some-dsn").install()

Sentry.setTagsContext({
    appVersion: DeviceInfo.getVersion(),
    buildNumber: DeviceInfo.getBuildNumber(),
    deviceInfo: {
      systemName: DeviceInfo.getSystemName(),
      systemVersion: DeviceInfo.getSystemVersion(),
      deviceName: DeviceInfo.getDeviceName(),
    },
})

Sentry.setUserContext({id: uid.toString()})

should be replaced with

import * as Sentry from '@sentry/react-native'

Sentry.init({
    dsn: "some-dsn",
    // some more options?
})

// ???

Having a table with at least the most important functions and their new/old forms would simplify the transition drastically.

@anka-213 Sorry about this, you can just do

Sentry.setTags({
    appVersion: DeviceInfo.getVersion(),
    buildNumber: DeviceInfo.getBuildNumber(),
}),
Sentry.setContexts('deviceInfo', {
      systemName: DeviceInfo.getSystemName(),
      systemVersion: DeviceInfo.getSystemVersion(),
      deviceName: DeviceInfo.getDeviceName(),
    });
Was this page helpful?
0 / 5 - 0 ratings