react-native: [RN 0.70.0-rc.2] React Native Lottie - function getModule: assertion failed (moduleAsValue.isObject())
Description
While testing the latest RC version, I’ve noticed the following error when starting the application:
Abort message: '/Users/alex/Documents/Projects/lottie-react-native/fabric-example/node_modules/react-native/ReactCommon/react/renderer/uimanager/bindingUtils.cpp:29: function getModule: assertion failed (moduleAsValue.isObject())'
@cortinico - I have provided a more simplified example project in my current WIP branch.
Version
0.70.1
Output of npx react-native info
System: OS: macOS 12.5 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 125.38 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.18 - ~/.yarn/bin/yarn npm: 5.1.0 - ~/Documents/Projects/lottie-react-native/node_modules/.bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /Users/alex/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 28, 29, 30, 31, 32, 33 Build Tools: 30.0.2, 30.0.3, 31.0.0 System Images: android-29 | Google Play Intel x86 Atom, android-31 | Google Play Intel x86 Atom_64, android-32 | Google APIs Intel x86 Atom_64, android-32 | Google Play Intel x86 Atom_64, android-33 | Google APIs Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.16 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.0-rc.2 => 0.70.0-rc.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
- Clone https://github.com/AlexanderEggers/lottie-react-native/tree/feature/add-fabric-support
- yarn install
- cd lib
- yarn build
- cd …/examples/fabric
- yarn android
Snack, code example, screenshot, or link to a repository
https://github.com/AlexanderEggers/lottie-react-native/tree/feature/add-fabric-support
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 32 (21 by maintainers)
@alfonsocj Thank you so much for looking into this problem from a different angle.
Based on your observations, I found the issue which was indeed part of the metro config file. I replaced my config with https://github.com/th3rdwave/react-native-safe-area-context/blob/main/fabric-example/metro.config.js for my fabric example project and seems to be working fine now. I believe that this specific behaviour really needs to be well documented for the new arch - these specific metro config changes were never needed for the old arch.
I also got the react-native-lottie library finally compatible with android for fabric 🎉 Just ios is missing but hopefully that won’t take as much time. 🤞
Thanks for reporting. For reference this a duplicate of #34056 #33618 As you provided a repro, we can investigate further 👍 I’ll get back to you
The native crash is most likely triggered by a wrong import on the JS side of things.
@cortinico’s comment is as accurate as it is understated!
I’ve spent many hours bisecting this issue, and found it to be caused by any uncaught exception raised by code that runs before the call to
AppRegistry.registerComponent()
.In my case, I was importing my package.json (several levels deep in the import chain from index.js) and then dereferencing a non-existent property.
After fixing up a lot of similar issues, app runs fine. It’s only unfortunate that the assertion makes them quite laborious to find.
I hit this assertion failure today in RNTester while working on the move to 0.70.3 for the Apple TV/Android TV fork.
I decided to debug it by just commenting out the
react_native_assert()
call and then see what happened… sure enough I then saw a Metro message that probably points to the real issue 👍Any follow-up on this? I’m getting essentially the same issue (but with RN 0.69.4) and am wondering if there’s a way forward or if I need to roll back to the old architecture.
Hello, I’m getting the same kind of error after upgrading from 0.67.x, happens to me on 0.69, 0.70.rc3-4, and 0.70 stable that recently went out.
E0905 22:27:22.525616 54329344 bindingUtils.cpp:27] getModule of AppRegistry is not an object E0905 22:27:22.525718 54329344 bindingUtils.cpp:29] react_native_assert failure: moduleAsValue.isObject() Assertion failed: (moduleAsValue.isObject()), function getModule, file bindingUtils.cpp, line 29.
I saw in a couple of other threads that the issue is not reproducing on a clean bootstrapped project, unfortunately in my case moving to a new skeleton project is not an option, many configurations and different environments are configured making it not a possible solution.
Anyone was able to pinpoint what exactly cause the issue? I’ve tried comparing all sorts of files in my project with the example project with no success so far
Oh I missed reporting back around this issue. We got a working preview version with the new arch running for RN Lottie. I believe we can close this issue. Thanks @cortinico
@AlexanderEggers can we close this? @j-piasecki issue has been fixed in https://github.com/facebook/react-native/issues/35495 also
Yeah I had a local branch with that. I will try to provide you with something by early next week. I will let you know.