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:
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.
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:
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 Answer
Reset to default 0Marco'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
app.js
try changinglocalhost
to127.0.0.1
. There are cases wherelocalhost
can resolve to::1
(on IPV6) instead of127.0.0.1
– Marco Commented Feb 4 at 15:33