Search code examples
react-nativesentryreact-native-sentry

TypeError: undefined is not an object (evaluating '_reactNative.Sentry.captureBreadcrumb')


I have upgraded to @sentry/react-native latest version with react-native version 0.62.2.

Already I am using react-native-sentry package with react-native version 0.59.9 it works fine.

After the upgrade, I have changed the import alone and run pod install. After bundle success evaluating '_reactNative.Sentry.captureBreadcrumb'. How to fix this?

My question is while upgrading sentry from react-native-sentry to @sentry/react-native and with the latest version of RN (0.62.2) shall I need to a setup wizard as mentioned here yarn sentry-wizard -i reactNative -p ios android https://docs.sentry.io/platforms/react-native/#linking.


Solution

  • That same documentation has a section for upgrading from react-native-sentry to @sentry/react-native:

    https://docs.sentry.io/platforms/react-native/#upgrading-from-react-native-sentry

    Basically first you react-native unlink react-native-sentry. Then:

    After that remove react-native-sentry from your package.json:

    npm uninstall react-native-sentry --save
    # or
    yarn remove react-native-sentry
    

    Once you've done that, just install @sentry/react-native as the documentation describes like if it was a new project.