Skip to content

[iOS] Crash after restarting Metro bundler: [runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'A0Auth0' could not be found. #1229

Description

@ildaneta

Checklist

Description

Environment

 expo-env-info 1.3.4 environment info:
    System:
      OS: macOS 15.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
      Yarn: 1.22.19 - /usr/local/opt/node/v14.20.1/bin/yarn
      npm: 6.14.17 - /usr/local/opt/node/v14.20.1/bin/npm
      Watchman: 2024.04.01.00 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.16.2 - /usr/local/opt/ruby/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.5, iOS 18.5, macOS 15.5, tvOS 18.5, visionOS 2.5, watchOS 11.5
      Android SDK:
        API Levels: 29, 30, 31, 33, 34, 35
        Build Tools: 29.0.2, 30.0.3, 31.0.0, 33.0.0, 33.0.1, 34.0.0, 35.0.0
        System Images: android-27 | Google APIs ARM 64 v8a, android-28 | Google APIs ARM 64 v8a, android-28 | Google ARM64-V8a Play ARM 64 v8a, android-29 | Google APIs ARM 64 v8a, android-29 | Google Play ARM 64 v8a, android-30 | Google Play ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a
    IDEs:
      Android Studio: 2024.3 AI-243.26053.27.2432.13536105
      Xcode: 16.4/16F6 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~53.0.10 => 53.0.11 
      react: 19.0.0 => 19.0.0 
      react-native: 0.79.3 => 0.79.3 
    Expo Workflow: bare

app.json

{
  "expo": {
    "name": "ODO",
    "displayName": "ODO",
    "slug": "odo",
    "scheme": "odo",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "dark",
    "newArchEnabled": true,
...
}

App.tsx

import { useEffect, useState } from 'react';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';

import { TamaguiProvider } from 'tamagui';
import { config } from './tamagui.config';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import { Navigation } from '@/navigation/RootNavigator';

import { Splash as PersonalizedSplash } from './src/components/Splash'

import { Auth0Provider } from 'react-native-auth0';
import { AUTH0_CLIENT, AUTH0_DOMAIN } from './src/constants';

import ErrorHandler from '@/components/ErrorHandler';

SplashScreen.preventAutoHideAsync();

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: 2,
    },
  },
});

export default function App() {
  const [fontsLoaded, error] = useFonts({
    'Agrandir-Regular': require('./assets/fonts/Agrandir-Regular.otf'),
    'Agrandir-Medium': require('./assets/fonts/Agrandir-Medium.otf'),
  });

  const [splashDone, setSplashDone] = useState(false);

  useEffect(() => {
    if (fontsLoaded || error) {
      SplashScreen.hideAsync();
    }
  }, [fontsLoaded]);

  if (!splashDone) {
    return <PersonalizedSplash onFinish={() => setSplashDone(true)} />;
  }

  if (!fontsLoaded && !error) {
    return null;
  }

  return (
    <QueryClientProvider client={queryClient}>
      <TamaguiProvider config={config}>
        <Auth0Provider domain={AUTH0_DOMAIN} clientId={AUTH0_CLIENT}>
          <ErrorHandler />
          <Navigation />
        </Auth0Provider>
      </TamaguiProvider>
    </QueryClientProvider>
  )
}

Hi! I'm running into an intermittent but reproducible issue when using the Auth0 SDK in a React Native project with Expo and Hermes enabled (iOS simulator).

After using any method from the Auth0 SDK in the app, if I:

Close the app on the iOS simulator,
Stop the Metro bundler,
Then relaunch the bundler (e.g., via yarn ios),
...the app crashes immediately with the following error:

[runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'A0Auth0' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

Image

Reproduction

  1. Launch the app using yarn ios.
  2. Use any method from the @auth0/react-native SDK (e.g., login).
  3. Close the app and stop the Metro bundler.
  4. Relaunch the bundler and app with yarn ios.
  5. Observe the crash with the error above.

[runtime not ready]: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'A0Auth0' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

Reinstalling the app yarn ios seems to resolve the issue temporarily, but it returns consistently if the steps above are repeated.

Additional context

This happens only after a full app restart following Auth0 usage.
It appears related to how the A0Auth0 TurboModule is registered or initialized at runtime when using Hermes.
This occurs in an Expo managed workflow, which limits direct native code modification.

Question

Is there any known workaround or fix for this behavior?

Thanks for your help and for maintaining this library!

react-native-auth0 version

^5.0.0-beta.3

React Native version

0.79.3

Expo version

~53.0.10

Platform

iOS

Platform version(s)

16.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on. It might be out of scope or does not otherwise align with goals

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions