Sentry-react-native: RNSentry.deviceContexts is undefined [Android]

Created on 1 Sep 2020  路  4Comments  路  Source: getsentry/sentry-react-native

OS:

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

Platform:

  • [ ] iOS
  • [x] Android

SDK:

  • [x] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 1.7.2
react-native version: 0.63.2

Are you using Expo?

  • [ ] Yes
  • [x] No

Are you using sentry.io or on-premise?

  • [x] sentry.io (SaaS)
  • [ ] on-premise

Configuration:

(@sentry/react-native)

  Sentry.init({
    dsn: config.sentry.dsn,
    debug: __DEV__ ? true : false
  })

I have following issue:

When logging errors, for example using Sentry.captureException, I'm getting the following error/warning:

Sentry Logger [Log]: Failed to get device context from native: TypeError: RNSentry.deviceContexts is not a function. (In 'RNSentry.deviceContexts()', 'RNSentry.deviceContexts' is undefined)

Steps to reproduce:

  1. Create new project npx react-native init AwesomeProject
  2. Install Sentry yarn add @sentry/react-native
  3. Open app.js and add the following:
import * as Sentry from "@sentry/react-native";

Sentry.init({
  dsn: "__DSN__" // My DSN hidden here
});

Sentry.captureMessage("Hello Sentry!");
  1. Run on device or emulator yarn run android

You can optionally also run npx sentry-wizard -i reactNative -p android to run the Sentry Wizard, but even after running the Wizard (thus adding settings and updating __android/app/build.gradle__) the issue persists.

Actual result:
I'm getting a warning about RNSentry.deviceContexts being undefined:

[Wed Sep 02 2020 08:16:27.839] LOG Sentry Logger [Log]: Integration installed: ReactNativeErrorHandlers
Expected result:
That I don't get the error :D

Type Bug

All 4 comments

Updated with reproducible example

@AdamGerthel Thanks! I am able to reproduce this. Will look into it ASAP.

Also having this issue on Android with latest Sentry/React Native packages:

@sentry/react-native": "^1.7.2
"react-native": "^0.63.2"

Can see a PR is open, do we have any idea when this might get merged and released? Thanks

@toughdeveloper It just got merged and we should have a release shorty!

Was this page helpful?
0 / 5 - 0 ratings