Fail to Bootstrap a MongoDB Realm app with Expo (@realm/expo-template-ts )

I want to install MongoDB Realm app with Expo in an Expo Development client (expo-dev-client) on my Android device (I am on Windows 10).

I followed the “Bootstrap with Expo - React Native SDK” procedure at https://www.mongodb.com/docs/realm/sdk/react-native/bootstrap-with-expo/ step by step.

The Android Bundling completes successfully apparently but when I select the app in the “development servers” screen of the dev-client on my Android device I have the following error:

ERROR Error: Exception in HostObject::get(propName:Realm): java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: librealm.so caused by: dlopen failed: cannot locate symbol “__emutls_get_address” referenced by “/data/app/~~RByWYhVyWSSKeF6nBOxNCg==/com.anonymous.realm11-yQ4HV5E7diRX4gos2lNp9w==/lib/arm64/librealm.so”… result: 0

ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.*

  • 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.**
    ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.*
  • 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**

What annoys me the most, apart from the fact that I lost hours on this problem already, is that I did not change anything in the @realm/expo-template-ts template. I may have missed something but it seems that the template and the procedure provided by MongoDB does not work today.

Any ideas? Thanks in advance

I haven’t been able to build an Expo + Realm app in the past month. Not a single template/repo/tutorial works. Truly disappointing. Our development has been stopped pretty much and it doesn’t look like they are gonna fix it anytime soon.

I made it work by using “realm”: “11.0.0” and getting rid of the babel stuff.

@Gilles_Jack , could you please share a repo or a package.json file?

I had to change Task.ts (without babel) and I added some nice traces.

I tested it on my Android device with USB cable and I used the local Expo CLI recomended by expo not the global one recommended by mondoDb. That’s another proof that MondoDB does not maintain and test Realm on React Native at the moment.

npm install
npx expo run:android (first time)
npx expo start --dev-client

1 Like

Thank you for the help. I was able to run the app successfully in the android emulator, but not in Expo Go. I uninstalled expo-cli from global and installed it locally, but still getting a warning that the command npx expo start --dev-client is getting executed from he global package. I am unable to get the app to run with Expo Go on my android phone even with an USB cable ( I am also running on windows 10):

Error: Missing Realm constructor. Did you run "pod install"? Please see https://docs.mongodb.com/realm/sdk/react-native/install/ for troubleshooting
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in errorHandler
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in <anonymous>
at node_modules\expo\build\errors\ExpoErrorManager.js:null in errorHandler
at node_modules\expo\build\errors\ExpoErrorManager.js:null in <anonymous>
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:null in guardedLoadModule
at http://192.168.100.7:19000/index.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:null in global code        

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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.
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in errorHandler
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in <anonymous>
at node_modules\expo\build\errors\ExpoErrorManager.js:null in errorHandler
at node_modules\expo\build\errors\ExpoErrorManager.js:null in <anonymous>
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in callFunctionReturnFlushedQueue

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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.
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in errorHandler
at node_modules\expo-dev-launcher\build\DevLauncherErrorManager.js:null in <anonymous>
at node_modules\expo\build\errors\ExpoErrorManager.js:null in errorHandler
at node_modules\expo\build\errors\ExpoErrorManager.js:null in <anonymous>
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in callFunctionReturnFlushedQueue

Because “npx expo run:android” called “npx expo prebuild”, the app escapes from the “managed workflow”.
So you can’t use Expo Go anymore. But that’s perfectly fine because you now have an “Expo Development client” that can now contain the native android code of Realm and that can be used in the same maner as Expo Go.

1 Like

Okay, thanks. I think I am understanding what you are explaining. I will have to do a bit of reading, new to mobile development. Just one final question that is of the most important to me: Will I be able to use EAS (Expo App Services) to publish and update my app?

PS: you are a saver, thanks again!

In fact, I am new to React (and Javacript world) too. I did the reading last week.
And I have not tried EAS yet.

I wish that we could just focus on developing apps and not spend our time setting up projects that should come ready out of the box…

1 Like

Hey all (@Damian_Danev @Gilles_Jack)! It seems our templates did not have versions for realm and react-native pinned, so the ended up causing issues when new releases came out. We just made a release of the expo template that should now work out of the box. Let us know if you run into any issues. Thanks!

PS - in regards to Expo Go, this app is unfortunately not compatible with realm or any other third party library that isn’t part of the base Expo SDK. Although Expo Go, is a great way to get going and familiarize yourself with React Native, it’s unfortunately not built for adding third-party libraries to it on the fly (unless they are pure JS libraries). But through the dev-client one is able to build their own custom “Expo Go”-ish app which one can use to update code live to whatever device is running it. More information

1 Like

Hi Andrew,

I won’t test the new template myself because this procedure still requires to install expo-cli globally which is not recommanded by Expo and can cause problems.

Moreoverver, realm 11.7.0 still does not work in my react native project (“react”: “18.1.0”, “react-native”: “0.70.8”). I get the following error at launch :


Android Bundling complete 11692ms
 ERROR  Error: Exception in HostObject::get(propName:Realm): java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so caused by: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~03La_fqEioklXzthzhDdmA==/com.podcastcutter1-Q7Dmqzp7e-cL_yoxCHSZWQ==/lib/arm64/librealm.so"... result: 0
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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.
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        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.

Only realm 11.0.0 work for me.
Regards

Correction, realm 11.7.0 now works with “react”: “18.2.0” and “react-native”: “0.71.6”.
Thanks.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.