question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.69.4 hermes crashes with use_frameworks! enabled

See original GitHub issue

Description

Using RN 0.69.4 and enabled hermes causes crash.

Able to get it working with Podfile changes, or disabling hermes.

  $static_library += [
    'React-hermes'
  ]

  pre_install do |installer|
      Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
      installer.pod_targets.each do |pod|
        bt = pod.send(:build_type)
        if $static_library.include?(pod.name)
          puts "Overriding the build_type to static_library from static_framework for #{pod.name}"
          def pod.build_type;
            Pod::BuildType.static_library
          end
        end
      end
      installer.pod_targets.each do |pod|
        bt = pod.send(:build_type)
        puts "#{pod.name} (#{bt})"
        puts "  linkage: #{bt.send(:linkage)} packaging: #{bt.send(:packaging)}"
        puts "  dynamic_library #{bt.send(:dynamic_library?)}"
        puts "  dynamic_framework #{bt.send(:dynamic_framework?)}"
        puts "  static_library #{bt.send(:static_library?)}"
        puts "  static_framework #{bt.send(:static_framework?)}"
      end
  end

It crashes at Could not get BatchedBridge, make sure your bundle is packaged correctly:

void JSIExecutor::bindBridge() {
  std::call_once(bindFlag_, [this] {
    SystraceSection s("JSIExecutor::bindBridge (once)");
    Value batchedBridgeValue =
        runtime_->global().getProperty(*runtime_, "__fbBatchedBridge");
    if (batchedBridgeValue.isUndefined() || !batchedBridgeValue.isObject()) {
      throw JSINativeException(
          "Could not get BatchedBridge, make sure your bundle is packaged correctly");
    }

Is this acceptable solution or is there another work-around?

Version

0.69.4

Output of npx react-native info

info Fetching system and libraries information… System: OS: macOS 12.4 CPU: (10) arm64 Apple M1 Max Memory: 159.59 MB / 32.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.16.0 - /usr/local/bin/node Yarn: 1.22.18 - /usr/local/bin/yarn npm: 8.11.0 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 25, 26, 27, 28, 29, 30, 31 Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0 System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-32 | Google APIs ARM 64 v8a, android-R | Google APIs Intel x86 Atom, chromeos-67 | Chrome OS 67 Android NDK: 22.1.7171670 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.16 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

See above desc.

Snack, code example, screenshot, or link to a repository

Nothing more.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:17

github_iconTop GitHub Comments

8reactions
evelantcommented, Aug 31, 2022

Yeah, can confirm 0.69.5 crashes on Release iOS build with use_frameworks! and hermes.

What’s almost worse is that development builds work. They apparently silently fall back to JSC.

react-native-firebase is forced to use use_frameworks! due to upstream firebase libraries. They can’t fix the problem going forward no matter what. That means that currently nobody can make release builds on iOS if they use what is probably one of the most popular libraries in the RN ecosystem. Downgrading to rn-firebase v14.11.1 is only a temporary fix.

The fix for this seem to clearly lie with react-native or hermes. How can we get this issue some attention? It’s likely impacting a lot of people.

8reactions
brianlenzcommented, Aug 12, 2022

We ran into this issue, too. react-native-firebase 15.x requires use_frameworks!, per:

https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

For us, the solution was to downgrade react-native-firebase to 14.x (and disable use_frameworks!) until there is better support for Hermes + use_frameworks!. Apparently 0.69.1 was supposed to have some support (and there was a patch-package for it at some point), but even with RN 0.69.4, it’s still clearly not fully supported.

It’s trivial to reproduce this issue. Just bootstrap a new, vanilla react-native app, edit the Podfile, enable use_frameworks! and set :hermes_enabled => true. Then, just run a Release build, and it’ll crash with the above error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo 46, EAS, react-native-firebase and hermes
Root cause is this issue: 0.69.4 hermes crashes with use_frameworks! enabled. expo-dev-client with useFramework static and hermes crashes on ...
Read more >
Using Hermes - React Native
Hermes is an open-source JavaScript engine optimized for React Native. ... Enabling Hermes on Older Versions of React Native​.
Read more >
React Native 0.69.5 White Screen Crash - Stack Overflow
:path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :production => production, ...
Read more >
React Native - Manual iOS Setup - Flipper
Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few...
Read more >
React Native Firebase
To use Static Frameworks on iOS, you also need to manually enable this for the ... To use use_frameworks with Hermes, make sure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found