realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.76k stars 572 forks source link

Unhandled JS Exception: Error: Missing Realm constructor. Did you run "pod install"? #5230

Open SyedSaifAli opened 1 year ago

SyedSaifAli commented 1 year ago

How frequently does the bug occur?

Sometimes

Description

This crash happens with every new install on a device and the app crashes within 1 sec.

RealmJS version : 10.24.0 Pod version: 10.32.1

Stacktrace & log output

# Crashlytics - Stack trace
# Platform: apple
# Version: 15.3.1 (217)
# Issue: b4a8529b73bff444c4a586261c7544ea
# Session: fc80e1b3d501496ab519955cc8b3a55f_DNE_0_v2
# Date: Mon Jan 09 2023 17:20:37 GMT+0530 (India Standard Time)

Fatal Exception: RCTFatalException: Unhandled JS Exception: Error: Missing Realm constructor. Did you run "pod install"? Please see https://realm.io/docs/react-native/latest/#missing-realm-constructor for troubleshooting
0  CoreFoundation                 0x9e88 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  appname                          0x1c0838 RCTFormatError + 166 (RCTAssert.m:166)
3  appname                          0x231b00 -[RCTExceptionsManager reportFatal:stack:exceptionId:] + 68 (RCTExceptionsManager.mm:68)
4  appname                          0x2322ec -[RCTExceptionsManager reportException:] + 135 (RCTExceptionsManager.mm:135)
5  CoreFoundation                 0x74704 __invoking___
6  CoreFoundation                 0x20b6c -[NSInvocation invoke]
7  CoreFoundation                 0x20584 -[NSInvocation invokeWithTarget:]
8  appname                          0x1ee5a0 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 587 (RCTModuleMethod.mm:587)
9  appname                          0x1f0718 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 183 (RCTNativeModule.mm:183)
10 appname                          0x1f03a0 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 419 (Optional.h:419)
11 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
12 libdispatch.dylib              0x3fdc _dispatch_client_callout
13 libdispatch.dylib              0xb694 _dispatch_lane_serial_drain
14 libdispatch.dylib              0xc1e0 _dispatch_lane_invoke
15 libdispatch.dylib              0x16e10 _dispatch_workloop_worker_thread
16 libsystem_pthread.dylib        0xdf8 _pthread_wqthread
17 libsystem_pthread.dylib        0xb98 start_wqthread

com.apple.main-thread
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  CoreFoundation                 0x7aaf0 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd34 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
7  GraphicsServices               0x1368 GSEventRunModal + 164
8  UIKitCore                      0x3a23d0 -[UIApplication _run] + 888
9  UIKitCore                      0x3a2034 UIApplicationMain + 340
10 appname                          0x39d3c main + 16 (main.m:16)
11 ???                            0x1b08ec960 (Missing)

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Crashed: com.google.firebase.crashlytics.ios.exception
0  appname                          0x9c284 FIRCLSProcessRecordAllThreads + 393 (FIRCLSProcess.c:393)
1  appname                          0x9c664 FIRCLSProcessRecordAllThreads + 424 (FIRCLSProcess.c:424)
2  appname                          0x93cd0 FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  appname                          0x8ec70 __FIRCLSExceptionRecord_block_invoke + 232 (FIRCLSException.mm:232)
4  libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
5  libdispatch.dylib              0x13574 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6  appname                          0x8dc7c FIRCLSExceptionRecord + 234 (FIRCLSException.mm:234)
7  appname                          0x8e790 FIRCLSExceptionRecordNSException + 126 (FIRCLSException.mm:126)
8  appname                          0x8d8d4 FIRCLSTerminateHandler() + 398 (FIRCLSException.mm:398)
9  libc++abi.dylib                0x10f28 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x10ec4 std::terminate() + 56
11 libobjc.A.dylib                0x33bec objc_terminate + 16
12 libdispatch.dylib              0x3ff0 _dispatch_client_callout + 40
13 libdispatch.dylib              0xb694 _dispatch_lane_serial_drain + 672
14 libdispatch.dylib              0xc1e0 _dispatch_lane_invoke + 384
15 libdispatch.dylib              0x16e10 _dispatch_workloop_worker_thread + 652
16 libsystem_pthread.dylib        0xdf8 _pthread_wqthread + 288
17 libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  CoreFoundation                 0x7aaf0 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd34 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
7  Foundation                     0x42334 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  Foundation                     0x4221c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9  UIKitCore                      0x4d733c -[UIEventFetcher threadMain] + 436
10 Foundation                     0x5b808 __NSThread__start__ + 716
11 libsystem_pthread.dylib        0x16cc _pthread_start + 148
12 libsystem_pthread.dylib        0xba4 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  appname                          0x961b8 FIRCLSMachExceptionServer + 192 (FIRCLSMachException.c:192)
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8

com.facebook.react.JavaScript
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  CoreFoundation                 0x7aaf0 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd34 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
7  appname                          0x1d1d00 +[RCTCxxBridge runRunLoop] + 378 (RCTCxxBridge.mm:378)
8  Foundation                     0x5b808 __NSThread__start__ + 716
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

JavaScriptCore libpas scavenger
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0xf6324 scavenger_thread_main + 1164
3  libsystem_pthread.dylib        0x16cc _pthread_start + 148
4  libsystem_pthread.dylib        0xba4 thread_start + 8

Heap Helper Thread
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3  JavaScriptCore                 0xd0fc bool WTF::Condition::waitUntilUnchecked<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4  JavaScriptCore                 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5  JavaScriptCore                 0x6ee5c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 352
6  JavaScriptCore                 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7  libsystem_pthread.dylib        0x16cc _pthread_start + 148
8  libsystem_pthread.dylib        0xba4 thread_start + 8

Heap Helper Thread
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3  JavaScriptCore                 0xd0fc bool WTF::Condition::waitUntilUnchecked<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4  JavaScriptCore                 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5  JavaScriptCore                 0x6ee5c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 352
6  JavaScriptCore                 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7  libsystem_pthread.dylib        0x16cc _pthread_start + 148
8  libsystem_pthread.dylib        0xba4 thread_start + 8

Heap Helper Thread
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3  JavaScriptCore                 0xd0fc bool WTF::Condition::waitUntilUnchecked<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4  JavaScriptCore                 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5  JavaScriptCore                 0x6ee5c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 352
6  JavaScriptCore                 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7  libsystem_pthread.dylib        0x16cc _pthread_start + 148
8  libsystem_pthread.dylib        0xba4 thread_start + 8

Heap Helper Thread
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3  JavaScriptCore                 0xd0fc bool WTF::Condition::waitUntilUnchecked<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4  JavaScriptCore                 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5  JavaScriptCore                 0x6ee5c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 352
6  JavaScriptCore                 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7  libsystem_pthread.dylib        0x16cc _pthread_start + 148
8  libsystem_pthread.dylib        0xba4 thread_start + 8

Heap Helper Thread
0  libsystem_kernel.dylib         0x141c __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x806c _pthread_cond_wait + 1232
2  JavaScriptCore                 0x4c6a4 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 1808
3  JavaScriptCore                 0xd0fc bool WTF::Condition::waitUntilUnchecked<WTF::Lock>(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 304
4  JavaScriptCore                 0xd578 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() + 248
5  JavaScriptCore                 0x6ee5c WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 352
6  JavaScriptCore                 0x710e4 WTF::wtfThreadEntryPoint(void*) + 16
7  libsystem_pthread.dylib        0x16cc _pthread_start + 148
8  libsystem_pthread.dylib        0xba4 thread_start + 8

com.apple.CoreMotion.MotionThread
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  CoreFoundation                 0x7aaf0 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x7bd34 __CFRunLoopRun + 1232
6  CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
7  CoreFoundation                 0xc4d04 CFRunLoopRun + 64
8  CoreMotion                     0x13ec0 CLMotionActivity::isTypeInVehicle(CLMotionActivity::Type) + 22820
9  libsystem_pthread.dylib        0x16cc _pthread_start + 148
10 libsystem_pthread.dylib        0xba4 thread_start + 8

Can you reproduce the bug?

Sometimes

Reproduction Steps

No response

Version

10.24.0

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

13+

Build environment

I am not able to reproduce this issue on my dev environment, but this is happening with users in production environment

Cocoapods version

10.32.1

takameyer commented 1 year ago

@SyedSaifAli Thanks for reporting this. What version of React-Native are you using? Do you have Hermes enabled?

SyedSaifAli commented 1 year ago

@takameyer I am using react native version 0.68.2 and no Hermes is not enabled.

takameyer commented 1 year ago

@SyedSaifAli Can you ensure that RealmJS is in your xcworkspace when you archive your app for release?

Screenshot 2023-01-10 at 16 35 39
SyedSaifAli commented 1 year ago

@takameyer No, RealmJS is not there, although Realm is present in the Pods. Am I missing something here?

Screenshot 2023-01-10 at 21 39 38
takameyer commented 1 year ago

My screenshot was from v11. We did make changes to how we bind Realm to react-native in the latest version, so it's possible an upgrade could resolve this issue (also includes support for Hermes). You would, however, need to upgrade react-native to 0.70

takameyer commented 1 year ago

Can you provide the contents of your Podfile? Perhaps something there is causing the issue

SyedSaifAli commented 1 year ago

@takameyer Sure, here is the Podfile.


# Uncomment the next line to define a global platform for your project
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 'app_name' do
  config = use_native_modules!

  use_modular_headers!

  # Pods for app_name

  pod 'Realm', '10.32.1'
  pod 'Avro-C', '1.7.6'
  pod 'GoogleMaps', '3.7.0'
  pod 'SocketRocket', '0.5.1'
  pod 'IQKeyboardManager'
  pod 'Firebase/Crashlytics' # , '4.3.0'
  pod 'Firebase/Analytics' #, '6.6.2'
  pod 'FirebaseInAppMessaging', '10.3.0-beta'

  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false

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

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()
    # post_install do |installer|
    # end

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # installer.pods_project.targets.each do |target|
    #   if target.name == 'React'
    #     target.remove_from_project
    #   end
    # end
  end
end
takameyer commented 1 year ago

Can you remove Realm from the podfile? This should be auto-linked.

SyedSaifAli commented 1 year ago

Okay, but I am using Realm in my native(objective c) as well. Shall I be able to use Realm still after removing it from podfile?

takameyer commented 1 year ago

@SyedSaifAli Ah, ok. If you are using the cocoa lib as well, then that makes sense to have it in there. Then the question is, is RealmJS in your generated project? If it's not, then that would make sense that we would see the issue you have submitted.

SyedSaifAli commented 1 year ago

How do I verify that? Can you help by sharing the steps if possible?

takameyer commented 1 year ago

One should be able to just pod install and see that it's in the Pods folder.

takameyer commented 1 year ago

Actually, it won't end up in the Pods folder, but it should be linked here: Screenshot 2023-01-11 at 11 27 14

ianpward commented 1 year ago

@SyedSaifAli Are you using both RealmJS and RealmSwift in the same app? How/why are you doing this?

SyedSaifAli commented 1 year ago

@takameyer Ohk, I can see RealmJS in my development Pods

Screenshot 2023-01-11 at 16 03 54
SyedSaifAli commented 1 year ago

@ianpward The reason for having both RealmJS and RealmSwift in the same app is, I have a few screens in my app which are in native(objective c) which requires access to the database so I need RealmSwift on my native side, and there are screens in my app which are in react-native so I need RealmJS in my react-native side as well for functioning.

takameyer commented 1 year ago

I'm a bit worried that those are conflicting somehow. Would you be able to test if the issue goes away with those Native screens disabled?

ianpward commented 1 year ago

Yeah unfortunately we don't support RealmJS and RealmSwift in the same app - it could be done but you need to match Core Database version numbers - you can find them here: https://github.com/realm/realm-js/blob/master/dependencies.list#L3 https://github.com/realm/realm-swift/blob/master/dependencies.list#L2

SyedSaifAli commented 1 year ago

@takameyer That's what the problem is, I am not able to reproduce this issue in my development environment or by creating a production app. This is happening with some users within 1 sec of app installation and I am not sure what's the reason of crash. And releasing the app to production by disabling the native screens can't be done

SyedSaifAli commented 1 year ago

@ianpward the versions I mentioned above. I am using realmjs version 10.24.0 which has the core version 12.12.0 and also Realm pod version is 10.32.1 which has the core version 12.11.0

Can this be the reason of crash that Core Database version are different for both js and swift?

takameyer commented 1 year ago

It's very possible. I would expect this to crash in development. Very odd that you are also not able to reproduce it by archiving your application and running it on device. Can you determine if there was a specific version of Realm that this started happening on? It's a bit of a guessing game for us, as we are also not able to produce this. We can only give you recommendations on how to proceed, but cannot guarantee this will solve the issue you are having. It's possible aligning on core versions or using the latest versions of our libraries will fix this.

SyedSaifAli commented 1 year ago

The last I remember we used version 10.20.0-beta.5 and after that, we started updating to subsequent versions, and this error started coming. It's strange that the core database version is different but still the app is getting successfully build without any errors. Although, I am making sure that now the DB version is the same on both the packages and sending a release. Let's check whether this is solving the problem.

kneth commented 1 year ago

@SyedSaifAli

Let's check whether this is solving the problem.

Any updates to share?

SyedSaifAli commented 1 year ago

@kneth No, Still the same issue, my current app has the realm js version 10.23.0 and realm-swift pod has version 10.32.1, still getting crashes.

SyedSaifAli commented 1 year ago

@takameyer

We can only give you recommendations on how to proceed, but cannot guarantee this will solve the issue you are having

I am open to recommendations, it's just that we are currently not planning for react native upgrade to 0.70, have planned to upgrade it sometime later, however, if there is anything else that you can recommend, I am happy to do it.

SyedSaifAli commented 1 year ago

this is becoming a pain now, @takameyer please help with what to do to move forward.

ianpward commented 1 year ago

hi @SyedSaifAli Product for Realm here. Unfortunately this is not a use case we test for and therefore do not support. I'm sorry about that - we need to do some in-depth research and generate a proposal to support. It is looking like it is going to be a pretty involved project and therefore a long-term project which is currently not on our roadmap. We will be sure to update you when we add it to our project plan.

susonthapa commented 1 year ago

We are running into this issue as well and it is the top crashes on iOS. We only use Realm-JS (no RealmSwift). We started seeing this issue after upgrading Realm from 10.20.1 to 11.4.0.

Used Versions:

realm@11.9.0
@realm/react@0.4.1
react-native@0.71.8

We have Hermes enabled in the app. This is a sub-second crash and usually, peaks after we push an update. The error message 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 doesn't make sense to us as we always run pod install before building the app and this doesn't happen to every user.

We have not been able to replicate this issue locally. Here is the JS stack trace.

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, j..., stack:
anonymous@49011:19
loadModuleImplementation@189:13
guardedLoadModule@110:37
metroRequire@42:91
anonymous@48974:28
loadModuleImplementation@189:13
guardedLoadModule@110:37
metroRequire@42:91
anonymous@48935:49
loadModuleImplementation@189:13
guardedLoadModule@110:37
metroRequire@42:91
anonymous@48697:29
loadModuleImplementation@189:13
guardedLoadModule@110:37
metroRequire@42:91
anonymous@1524:38
loadModuleImplementation@189:13
guardedLoadModule@110:37
metroRequire@42:91
anonymous@801:31
loadModuleImplementation@189:13
guardedLoadModule@102:46
metroRequire@42:91
global@424056:3

Here is the native stack trace.

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                 0x948c __exceptionPreprocess
1  libobjc.A.dylib                0x15050 objc_exception_throw
2  [Redacted APP_NAME]                         0x289b44 RCTFormatError + 167 (RCTAssert.m:167)
3  [Redacted APP_NAME]                              0x2efe40 -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:] + 77 (RCTExceptionsManager.mm:77)
4  [Redacted APP_NAME]                              0x2f0684 -[RCTExceptionsManager reportException:] + 147 (RCTExceptionsManager.mm:147)
5  CoreFoundation                 0x6dfc0 __invoking___
6  CoreFoundation                 0x1f248 -[NSInvocation invoke]
7  CoreFoundation                 0x1ede8 -[NSInvocation invokeWithTarget:]
8  [Redacted APP_NAME]                              0x2b4180 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 587 (RCTModuleMethod.mm:587)
9  [Redacted APP_NAME]                              0x2b6374 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 196 (RCTNativeModule.mm:196)
10 [Redacted APP_NAME]                              0x2b5ffc ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 419 (Optional.h:419)
11 libdispatch.dylib              0x637a8 _dispatch_call_block_and_release
12 libdispatch.dylib              0x64780 _dispatch_client_callout
13 libdispatch.dylib              0xa298 _dispatch_lane_serial_drain$VARIANT$mp
14 libdispatch.dylib              0xad70 _dispatch_lane_invoke$VARIANT$mp
15 libdispatch.dylib              0x14dc8 _dispatch_workloop_worker_thread
16 libsystem_pthread.dylib        0x1bd0 _pthread_wqthread
17 libsystem_pthread.dylib        0x1720 start_wqthread

Could this be related to cyclic dependencies in the app? We have a couple of those right now.

kosbog commented 2 months ago

I'm also have this exactly error. But I get it after installing the codepush update and only in release mode. I've tried everything, I can't find a fix.

"realm": "12.5.1", "@realm/react": "^0.9.0", "react-native": "0.71.6", "react-native-code-push": "^8.2.1",

kneth commented 2 months ago

@kosbog

From react-native-code-push:

Note: Any product changes which touch native code (e.g. modifying your AppDelegate.m/MainActivity.java file, adding a new plugin) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s).

As Realm JS is containing native code, it looks like the combination isn't expected to work.

kosbog commented 1 month ago

@kneth I know that. That's why I made a new build for the testflight. And this build had all the latest changes, so it is completely fresh. And this, by the way, also worries me - why does a fresh build receive an update that is already in this code?

kneth commented 1 month ago

@kosbog I have close-to-zero knowledge about react-native-code-push but I wonder if https://github.com/microsoft/react-native-code-push/issues/2179#issuecomment-1006036747 can help you?