realm-js: Latest Hermes Realm + Reanimated V2 = Crash on re-open

How frequently does the bug occur?

Sometimes

Description

Hey!

I’m seeing tons of crashes coming in from our users ever since we added reanimated v2 to our project. Everything was going perfectly with 10.20.0-beta.2. But then the crashes started coming in when we added Reanimated v2.

We have no idea why it’s happening but we get:

Fatal Exception: RCTFatalException: Unhandled JS Exception: Error: Missing Realm constructor. Did you run "pod install"? through firebase console.

Stacktrace & log output

Fatal Exception: RCTFatalException: Unhandled JS Exception: Error: Missing Realm constructor. Did you run "pod install"? Please see https://docs.mongodb.com/realm/sdk/react-native/install/ for troubleshooting, js engine: hermes
0  CoreFoundation                 0x99d78 __exceptionPreprocess
1  libobjc.A.dylib                0x16734 objc_exception_throw
2  Nuna                           0x2bb368 RCTFormatError + 166 (RCTAssert.m:166)
3  Nuna                           0x33becc -[RCTExceptionsManager reportFatal:stack:exceptionId:] + 68 (RCTExceptionsManager.mm:68)
4  Nuna                           0x33c8d4 -[RCTExceptionsManager reportException:] + 135 (RCTExceptionsManager.mm:135)
5  CoreFoundation                 0x22614 __invoking___
6  CoreFoundation                 0x40100 -[NSInvocation invoke]
7  CoreFoundation                 0x7713c -[NSInvocation invokeWithTarget:]
8  Nuna                           0x2eeee4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 587 (RCTModuleMethod.mm:587)
9  Nuna                           0x2f1528 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 183 (RCTNativeModule.mm:183)
10 Nuna                           0x2f114c invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 419 (Optional.h:419)
11 libdispatch.dylib              0x1e68 _dispatch_call_block_and_release
12 libdispatch.dylib              0x3a2c _dispatch_client_callout
13 libdispatch.dylib              0xb124 _dispatch_lane_serial_drain
14 libdispatch.dylib              0xbc80 _dispatch_lane_invoke
15 libdispatch.dylib              0x16500 _dispatch_workloop_worker_thread
16 libsystem_pthread.dylib        0x10bc _pthread_wqthread
17 libsystem_pthread.dylib        0xe5c start_wqthread

Can you reproduce the bug?

Yes, sometimes

Reproduction Steps

This usually never happens on fresh install. It only happens if users quit the app and then relaunch.

Version

10.20.0-beta.2

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS

Build environment

PodFile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'aya' do
  # Pods for aya

  config = use_native_modules!
 
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )


  target 'ayaTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
Package JSON:
"dependencies": {
        "@hexigames/react-native-apple-ads-attribution": "^1.0.2",
        "@invertase/react-native-apple-authentication": "^2.1.0",
        "@notifee/react-native": "^5.0.2",
        "@react-native-async-storage/async-storage": "^1.15.17",
        "@react-native-community/cli-platform-ios": "6.2.0",
        "@react-native-community/netinfo": "7.1.2",
        "@react-native-community/push-notification-ios": "^1.10.1",
        "@react-native-community/slider": "^4.1.10",
        "@react-native-firebase/app": "^14.5.0",
        "@react-native-firebase/auth": "^14.5.0",
        "@react-native-firebase/crashlytics": "^14.5.0",
        "@react-native-firebase/dynamic-links": "^14.5.0",
        "@react-native-firebase/messaging": "^14.5.0",
        "@react-native-firebase/perf": "^14.5.0",
        "@react-native-firebase/remote-config": "^14.5.0",
        "@react-native-google-signin/google-signin": "7.0.1",
        "@react-native-seoul/masonry-list": "^1.0.6",
        "@react-navigation/bottom-tabs": "^6.0.9",
        "@react-navigation/native": "^6.0.6",
        "@react-navigation/stack": "^6.0.11",
        "@segment/analytics-react-native": "^1.4.4",
        "@segment/analytics-react-native-amplitude": "^1.4.4",
        "@segment/analytics-react-native-firebase": "^1.5.0",
        "axios": "0.26.1",
        "lottie-ios": "3.2.3",
        "lottie-react-native": "5.0.1",
        "moment": "^2.25.3",
        "patch-package": "^6.4.7",
        "postinstall-postinstall": "^2.1.0",
        "prop-types": "^15.7.2",
        "react": "17.0.2",
        "react-native": "0.67.4",
        "react-native-check-box": "^2.1.7",
        "react-native-circular-progress-indicator": "^2.0.6",
        "react-native-date-picker": "^4.1.5",
        "react-native-dotenv": "^2.5.3",
        "react-native-flash-message": "0.2.0",
        "react-native-gesture-handler": "^1.10.3",
        "react-native-in-app-review": "^3.3.2",
        "react-native-linear-gradient": "^2.5.6",
        "react-native-modal": "13.0.0",
        "react-native-onesignal": "4.3.5",
        "react-native-progress-circle": "^2.1.0",
        "react-native-purchases": "^4.5.2",
        "react-native-reanimated": "^2.4.1",
        "react-native-safe-area-context": "^3.3.2",
        "react-native-screens": "^3.9.0",
        "react-native-snap-carousel": "^3.9.1",
        "react-native-svg": "^12.1.0",
        "react-native-svg-transformer": "^0.14.3",
        "react-native-webview": "^9.4.0",
        "react-native-youtube": "^2.0.1",
        "react-redux": "^7.2.0",
        "realm": "v10.20.0-beta.2",
        "redux": "^4.0.5",
        "redux-thunk": "^2.3.0"
    },
    "devDependencies": {
        "@babel/core": "^7.16.0",
        "@babel/eslint-parser": "^7.16.3",
        "@babel/runtime": "7.12.5",
        "@react-native-community/eslint-config": "^2.0.0",
        "babel-eslint": "^10.1.0",
        "babel-jest": "26.6.3",
        "eslint": "^7.14.0",
        "eslint-plugin-react": "^7.26.0",
        "eslint-plugin-react-hooks": "^4.3.0",
        "eslint-plugin-react-native": "^3.11.0",
        "eslint-plugin-unicorn": "^39.0.0",
        "husky": "^4.3.8",
        "jest": "26.6.3",
        "jetifier": "^1.6.6",
        "lint-staged": "^10.5.4",
        "metro-react-native-babel-preset": "0.66.2",
        "prettier": "^2.0.5",
        "pretty-quick": "^3.1.0",
        "react-native-clean-project": "^3.6.4",
        "react-test-renderer": "17.0.2"
    },

Cocoapods version

1.11.2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (9 by maintainers)

Most upvoted comments

Some notes from our experience. It only happnes on IOS production. There is no way to reproduce this on development. Also Crash happens randomly. 1 out of 10 times it works without any issues.

Just in case anyone else has this problem. We have solved our crash problem by upgrading our react-navigation from 5.x to 6.x and removed any references to re-animated from our dependencies.

Same error on realm@10.20.0-beta.3. This only happens on iOS.