FG
🔌 APIs & SDKsGoogle

auth/network-request-failed when debugging on react native

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score78%
78%

Problem

[REQUIRED] Describe your environment Operating System version: Mac 10.14.6 Browser version: Chrome Version 79.0.3945.130 Firebase SDK version: 6.6.2 Firebase Product: auth (auth, database, storage, etc) React Native version: 0.61.5 [REQUIRED] Describe the problem Getting an error when running on debug mode on the simulator (both for ios and android) [code block] Works fine on the simulator when I'm not debugging. Happens also for other teammates that work on the same project * Rebooting Chrome didn't help Steps to reproduce: Relevant Code: I created a small react native app to reproduce the bug: https://github.com/shirlev-wix/firebase-bug [code block] Thanks!

Error Output

error when running on debug mode on the simulator (both for ios and android)

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix auth/network-request-failed Error in React Native Debug Mode

Medium Risk

The 'auth/network-request-failed' error in React Native when debugging is often caused by the debugger interfering with network requests, particularly when using Firebase. This can happen due to issues with the network configuration, the React Native packager, or the way Firebase is initialized in debug mode.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Check Network Configuration

    Ensure that the network configuration in your simulator is set up correctly. Sometimes, the simulator may not have proper access to the network when debugging.

  2. 2

    Disable Remote Debugging

    Try disabling remote debugging in your React Native app. You can do this by shaking the device or using the keyboard shortcut (Cmd+D for iOS, Cmd+M for Android) and selecting 'Stop Remote Debugging'. This may resolve the network request issues.

  3. 3

    Update Firebase SDK

    Update your Firebase SDK to the latest version. Sometimes, bugs are fixed in newer releases. You can update the SDK by running the following command in your project directory:

    bash
    npm install firebase@latest
  4. 4

    Check Firebase Initialization

    Ensure that Firebase is correctly initialized in your app. Check your Firebase configuration and ensure that it is done before any Firebase calls are made. Here’s an example:

    javascript
    import firebase from 'firebase/app';
    import 'firebase/auth';
    
    const firebaseConfig = { /* your config */ };
    if (!firebase.apps.length) {
      firebase.initializeApp(firebaseConfig);
    }
  5. 5

    Clear Cache and Restart

    Clear the cache of your React Native project and restart the packager. You can do this by running the following commands:

    bash
    npm start -- --reset-cache

Validation

To confirm the fix worked, run your React Native app in debug mode again and attempt to reproduce the error. If the error does not appear and the app functions normally, the issue is resolved.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

firebasegooglesdkbugapi:-authneeds-attentionplatform:react-native