bugsnag-js icon indicating copy to clipboard operation
bugsnag-js copied to clipboard

Bugsnag react native throws TypeError: undefined is not an object (evaluating 'navigator.userAgent.length') error

Open prrrthiksh opened this issue 3 years ago • 1 comments

Describe the bug

Getting an error TypeError: undefined is not an object (evaluating 'navigator.userAgent.length') with the react native implementation Please note that this happens with both manual and CLI setup Probably similar to https://github.com/bugsnag/bugsnag-js/issues/1676

Steps to reproduce

  1. Setup bugsnag react native according to https://docs.bugsnag.com/platforms/react-native/react-native/
  2. Call Bugsnag.start() in index.js
  3. Run RN instance (react-native run-android/ios --variant debug) on android or iOS simulator

Environment

"react": "17.0.2", "react-native": "0.67.2", "@bugsnag/react-native": "7.17.3", "@bugsnag/source-maps": "2.3.1", "@react-navigation/native": "6.0.11", "@react-navigation/native-stack": "6.7.0",

iOS dependencies

pod BugsnagReactNative 7.17.3

Android dependencies

gradle plugin com.bugsnag:bugsnag-android-gradle-plugin:5.+

Error messages:
TypeError: undefined is not an object (evaluating 'navigator.userAgent.length')
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

prrrthiksh avatar Aug 24 '22 13:08 prrrthiksh

Hi @prrrthiksh , I have responded via the support ticket you raised, but for the benefit of future users that come across this thread, we haven't been able to reproduce this issue given the above reproduction step. I will keep this thread updated if anything changes.

Cga95 avatar Sep 02 '22 10:09 Cga95

Hi @prrrthiksh. Going to close this out as we haven't heard from you on the related support ticket. If you can help us with some of the outstanding questions on there we can investigate further. Thanks

johnkiely1 avatar Oct 06 '22 11:10 johnkiely1

I am seeing this, too with Expo SDK 48 and @bugsnag/expo 48.1.0 🤔 ..

image

kennethlynne avatar Apr 20 '23 10:04 kennethlynne

I had this issue happen to me while using rnx-kit/metro-config Magically disappeared when I reverted back to the default metro config.

prrrthiksh avatar Apr 20 '23 11:04 prrrthiksh