bugsnag-js
bugsnag-js copied to clipboard
Bugsnag react native throws TypeError: undefined is not an object (evaluating 'navigator.userAgent.length') error
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
- Setup bugsnag react native according to https://docs.bugsnag.com/platforms/react-native/react-native/
- Call Bugsnag.start() in index.js
- 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.
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.
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
I am seeing this, too with Expo SDK 48 and @bugsnag/expo 48.1.0 🤔 ..
I had this issue happen to me while using rnx-kit/metro-config
Magically disappeared when I reverted back to the default metro config.