1

im using react-native-firebase v21.6.1 and im trying to start the auth service emulation. Ive gotten the firestore and functions emulation working.

firebase.json

"emulators": {
  "functions": {
    "port": 5001
  },
  "firestore": {
    "port": 8080
  },
  "auth": {
    "port": 9099
  },
  "ui": {
    "enabled": true
  },
  "singleProjectMode": true
}

app.js:

import functions from '@react-native-firebase/functions';
import firestore from '@react-native-firebase/firestore';
import auth from '@react-native-firebase/auth';

...
if (__DEV__) {
  firestore().useEmulator('localhost', 8080);
  functions().useEmulator('localhost', 5001);
  auth().useEmulator('http://localhost:9099');
}

It seems to have connected successfully:

enter image description here

Using auth().createUserWithEmailAndPassword would throw this error:

Error: [auth/network-request-failed] A network error has occurred, please try again.]

I execute npx expo run:ios to start a development build on the ios simulator.

1
  • 1
    In your app.js try changing localhost to 127.0.0.1. There are cases where localhost can resolve to ::1(on IPV6) instead of 127.0.0.1 Commented Feb 4 at 15:33

1 Answer 1

0

Marco's answer is right,

I was facing the same issue as you and if you change

if (__DEV__) {
    firestore().useEmulator('localhost', 8080);
    storage().useEmulator('localhost', 9199);
-   auth().useEmulator("http://localhost:9099"); // from this
+   auth().useEmulator("http://127.0.0.1:9099"); // to this
}

Then i suggest to rebuild the app and log out of your app.

You will be able to see something like this in the console

screenshot of expected result

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.