firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.6k stars 1.06k forks source link

unable to run local env vs firebase emulator auth/network-request-failed #838

Open vitaly87 opened 3 years ago

vitaly87 commented 3 years ago

Hi all. I am trying to run web ui and firebase emulator the issue that I am getting error:

code: "auth/network-request-failed" message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."

init the simulator


if (window.location.hostname === "localhost") {
    console.log("localhost detected!");
    firebase.auth().useEmulator("http://localhost:9099");
    firebase.database().useEmulator("localhost", 9000);
  }

my code for login

 firebase
      .auth()
      .signInWithEmailAndPassword(email, password)
      .then((userCredential) => {
strom2357 commented 3 years ago

Hi, thanks for sharing. Can you share logs showing the request being made? Often this issue turns out to be the wrong port being used.

yuchenshi commented 3 years ago

Also, when you run firebase emulators:start, it should print out the right ports to use in the CLI output. The ports can be changed to match if needed -- see https://firebase.google.com/docs/emulator-suite/install_and_configure#configure_emulator_suite to get started