auth/network-request-failed when debugging on react native
[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: "auth/network-request-failed"
message: "A network error (such as timeout, interrupted connection or unreachable host) has
occurred."
- 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
return Promise.resolve()
.then(() => firebase.initializeApp(options, this.name))
.then(app => app.auth().signInWithCustomToken(authKey)
Thanks!
Thanks for the report, @shirlev-wix. While I'm trying to replicate this, can you try using the latest version (7.8.2)? Most of these reports tend to be network related. If you can get network logs, that would be very helpful.
@shirlev-wix I'm trying to reproduce this issue but haven't been able to. Putting your working repro up on StackBlitz would be very helpful as we could fork it and might help you get it running. Thanks!
Hey @shirlev-wix. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Hi, Upgrading firebase didn't help. I created a small react native app to reproduce the bug. https://github.com/shirlev-wix/firebase-bug
When debugging you can see the UI stays not connected.
Hi @rommelpe! Any updates regarding this one? It is really making our life harder when trying to debug things related to firebase.
same issue --
code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."
"firebase": "^7.13.2",
"react": "16.9.0",
"react-native": "0.61.5",
Not sure is the same, but I get a an error saying I have no connection on my device on an Android Emulator, but making requests with i.e. unfetch library, work just fine.
edit: In my case it happens with await Firestore.collection('users').get()
Our users experience the same auth/network-request-failed firebase auth issues since some time now. It mainly happens to Android Chrome users and the issue start immediately after/during using firebase.auth().signInAnonymously. (Note: I'm not using react, I simply use plain old Node.js SSR with vanilla js)
I'm also having a hard time reproducing the issue, I tried many real devices as well as devices on Browserstack. I'm just not getting this issue.
I already made sure that
- there is no
formhtml tag used - the call to action button is a
<button type='button'>Signup</button>element - no session cookie/token revocation happens
Any ideas or any idea how I could reproduce it myself? Thanks a lot!
I'm receiving the same issue with React. I was testing logging in and it was returning a user object. 10 or so times later, it just stopped working and I have got the message Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred. for the past 12 hours.
Possible ways to resolve? Is this possibly a limit issue? Should I delete node_modules and do a fresh install of the the npm packages? Should I downgrade the firebase library?
"firebase": "^7.15.1",
"react": "^16.13.1",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"redux-saga-firebase": "^0.15.0"
I'm facing the same error when trying to use google/facebook signing with popup, used to work before and nothing change in the code.
//version
"firebase": "^7.15.5"
let provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider).then(e => ...)
Im facing the same error using google to sign in with signInWithPopup. Works for some users just fine but fails for other users. //version "firebase": "^7.15.5"
I am running into the same error using google to sign in to my web app build with next js and deployed on vercel. Both on local, development and production.

"firebase": "^7.14.2",
Please advice
Folks-
Thanks for reporting this, does anyone have a trace for the endpoint and underlying error (like in https://github.com/firebase/firebase-js-sdk/issues/3081#issuecomment-631589480)? The Network Error you are seeing is a generic error we throw when the underlying fetch() call fails.
In my case with signInWithPopup the pop up url (app-name/__/auth/...) was unreachable and no redirect to facebook/google happens, it worked again days later without changing anything.
Hey @shirlev-wix. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
What kind of information do you need? Like I wrote on March 6, here's a demo project that reproduce the bug: https://github.com/shirlev-wix/firebase-bug
I'm having the same issue with a React Native Expo app. All of the sudden I cant make any development and I'm stuck with this unexpected error.
@obrunopolo , I faced with network problems on Android working with Expo too. I don't have a permanent solution, though two things work for me while developing:
- Using a DNS proxy 8.8.8.8 for Android emulator.
- Using a cell provider network on my dev Android device instead of any WiFi networks.
I hope this will help you for development and there will be a fix from Firebase team soon.
I had the same Error. I solved it by Turning on the my phones internet connection by connecting to wifi.
Solution Turn on your phone's internet connection.
@Georgemburu that is not a "solution". Do you believe someone would come to GitHub and comment on this Issue just because the internet connection isn't on? I had this issue on a specific private wifi connection, all apps were working fine, except mine.
So I was having a similar issue where I was getting [Error: [auth/network-request-failed] A network error has occurred, please try again.] on and IOS phone whenever I tried to auth().signInWithPhoneNumber(phoneNumber)
And the reason for that was because the Date and Time on the phone was wrong 🤷🏻♂️
Hi all, this issue is being tracked internally at b/171738114. It's on our radar to investigate, but unfortunately we don't have a timeline for this right now.
I am getting the same error, while using google-auth in react, on chrome browser. The authentication was working fine just yesterday. I am using a button to call the authentication function.
<button id="login">LOG IN</button>
It's November 2020, firebase login was working fine until yesterday, but now it does not work anymore.
It always throws auth/network-request-failed error 👎
@google-oss-bot @shirlev-wix @Georgemburu
Any updates on this? some of my users started facing this issue, and are stuck out of app.
In my case with signInWithPopup the pop up url (app-name/__/auth/...) was unreachable and no redirect to facebook/google happens, it worked again days later without changing anything.
We are also facing this issue. On one particular occasion, we tried to debug the cause for 4 hours and then it was back to working. Another in most of the cases, changing the network connection (from broadband to mobile hotspot) helped get around this issue.
Recently I faced this issue twice on consecutive Mondays.
@Georgemburu that is not a "solution". Do you believe someone would come to GitHub and comment on this Issue just because the internet connection isn't on? I had this issue on a specific private wifi connection, all apps were working fine, except mine.
@obrunopolo Yes I agree this is not the issue. Although this is mostly not an issue related to network and firebase should get some help if changing networks solves this issue. I have also switched between 2 working connection, but it works on one network and fails on another.
Same error/issue. Suddenly. Did not change anything. It was working a while back perfectly. Pasting my error in the log which I'm getting from the code
firebase.auth().signInWithPopup(provider).then(function (result) {
...
}).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
console.log(error); //This it the error being consoled.
});
The error in console:
_> u {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred.", a: null}
a: null code: "auth/network-request-failed" message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred." proto: Error constructor: ƒ u(a, b, c) Za: constructor: ƒ Error() message: "" name: "Error" toString: ƒ toString() proto: Object arguments: (...) caller: (...) length: 3 name: "u" prototype: Error {constructor: ƒ, v: ƒ, toJSON: ƒ} proto: ƒ () [[FunctionLocation]]: auth.esm.js:411 [[Scopes]]: Scopes[4] toJSON: ƒ d() v: ƒ () proto: Object_
Please help. Is there nay development on this issue? The error is coming in production. Users are not able to login. Please help. Thank you so much in advance.
Same error/issue. Suddenly. Did not change anything. It was working a while back perfectly. Pasting my error in the log which I'm getting from the code
firebase.auth().signInWithPopup(provider).then(function (result) { ... }).catch(function (error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; console.log(error); //This it the error being consoled. });The error in console:
_> u {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred.", a: null}
a: null code: "auth/network-request-failed" message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred." proto: Error constructor: ƒ u(a, b, c) Za: constructor: ƒ Error() message: "" name: "Error" toString: ƒ toString() proto: Object arguments: (...) caller: (...) length: 3 name: "u" prototype: Error {constructor: ƒ, v: ƒ, toJSON: ƒ} proto: ƒ () [[FunctionLocation]]: auth.esm.js:411 [[Scopes]]: Scopes[4] toJSON: ƒ d() v: ƒ () proto: Object_
Please help. Is there nay development on this issue? The error is coming in production. Users are not able to login. Please help. Thank you so much in advance.
Please check if changing network solves this issue. I am also facing this issue with firebase-js-sdk.. It is very bad experience