Skip to content

auth/network-request-failed when using Firebase Auth in Expo React Native with Hermes #9113

Closed
@mmaxwell22

Description

@mmaxwell22

Operating System

iOS 17.4 (Simulator), macOS Ventura 13.4

Environment (if applicable)

Expo SDK 53, Node.js v18.16.0, React Native 0.73.3, Hermes enabled, running on iOS Simulator (iPhone 15 Pro)

Firebase SDK Version

9.23.0

Firebase SDK Product(s)

Auth

Project Tooling

Expo CLI, React Native (bare workflow compatible), Firebase Modular SDK (v9), firebase/auth/react-native with getReactNativePersistence(AsyncStorage), Xcode 16.3

Detailed Problem Description

I'm trying to implement email/password authentication using Firebase Auth in a React Native app with Expo SDK 53 (Hermes enabled). Everything is working fine on the Android emulator, but on the iOS simulator I consistently get the following error when calling createUserWithEmailAndPassword:

vbnet
Firebase: Error (auth/network-request-failed)
Here’s additional logging from the console:

📧 Email: test@example.com
🔐 Password: ********
🧪 Type check: string string
❌ Firebase ping failed: [TypeError: Network request failed]
I’ve confirmed:

The email and password are valid.

Firebase is initialized correctly using firebase/auth/react-native.

I’m using getReactNativePersistence(AsyncStorage) in initializeAuth.

My .env file has the correct Firebase config.

I am testing this on a Mac with the iOS simulator using a physical network connection (not offline).

The Firebase project has email/password login enabled.

Authorized domains are set up in Firebase (localhost, 127.0.0.1, etc.)

Despite all of this, iOS throws a network error every time I try to sign up or sign in a user.

This issue seems specific to the iOS simulator and doesn’t appear on Android.

Steps and code to reproduce issue

// firebase.js
import { initializeApp } from 'firebase/app';
import { getAuth, initializeAuth, getReactNativePersistence } from 'firebase/auth/react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';

const firebaseConfig = {
apiKey: 'MY_API_KEY',
authDomain: 'MY_PROJECT.firebaseapp.com',
projectId: 'MY_PROJECT',
storageBucket: 'MY_PROJECT.appspot.com',
messagingSenderId: '...',
appId: '...'
};

const app = initializeApp(firebaseConfig);

const auth = initializeAuth(app, {
persistence: getReactNativePersistence(AsyncStorage),
});

export { auth };

import { createUserWithEmailAndPassword } from 'firebase/auth';
import { auth } from './firebase';

await createUserWithEmailAndPassword(auth, email, password);

Firebase: Error (auth/network-request-failed)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions