Sentry internal isNativeFetch function found to be undefined and crashes iOS app on RN 0.64.2
See original GitHub issueEnvironment
How do you use Sentry? Sentry SaaS (sentry.io)
Which SDK and version? @sentry/react-native: 2.5.1 @sentry/browser: 6.7.1 @sentry/hub: 6.7.1 @sentry/tracing: 6.7.1
Steps to Reproduce
-
Use latest sentry react-native library with react-native 0.64.2.
-
Once the app is built using fastlane and pushed to Testflight, opening the app crashes on any iOS device with
Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: TypeError: s.isNativeFetch is not a function. (In 's.isNativeFetch(o.fetch)', 's.isNativeFetch' is undefined)', reason: 'Unhandled JS Exception: TypeError: s.isNativeFetch is not a function. (In 's.isNativeFetch(o.fetch)', 's.isNativeFetch' is undefined)
Note that it works fine with react-native 0.63.2. We searched our codebase for isNativeFetch and we found that it’s an internal function inside our sentry dependencies.
Expected Result
App to not crash 😃
Actual Result
Here’s a screenshot from the iOS app device log:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@jennmueng https://github.com/necolas/react-native-web is quite popular (e.g. expo web uses it) so it might be worth considering but to be honest we’ve not needed direct web support as it’s easy to have sentry setup for both native and web, i.e. we have a
/app/platform/sentry/index.js
that proxies@sentry/react-native
and/app/platform/sentry/index.web.js
that proxies@sentry/browser
and then in our code we reference/app/platform/sentry
and that will use the correct proxy depending if running on native or web.@jennmueng we wouldn’t normally include the other sentry dependencies but we’re using react-native-web so that the same codebase works both on the mobile app & web app and for the web we have to include
@sentry/browser
and other necessary dependencies. But good point regarding using the correct version (thanks!), even though it seems to be working fine we will downgrade to6.5.1
and see if it works ok 👍