Firebase emulator from local network

1.2k Views Asked by At

firebase command firebase emulators:start all ports and hosts work fine on my pc but but if I try from different device in my network (ohter pc) to access network-ip:8080 I get connection refused.

This does not worked:

firebase.firestore().useEmulator("0.0.0.0", 8080);

But this worked:

firebase.firestore().useEmulator("192.168.x.x", 8080);

Why first one was not working but second one worked did not understand the reason behind this

2

There are 2 best solutions below

0
On

Are you sure that the port that you are trying to connect to is opened? I ran through the same issue with Ubuntu firewall blocking the request. If you are using Ubuntu use this command to open the port.

    sudo ufw allow 9299
2
On

0.0.0.0 is not a valid destination address for outgoing connections, such as those being made by the Firebase SDK to connect to the emulator. It is only a valid incoming address for services that want to listen on all possible IP addresses assign to the machine where it's running.

I recommend doing a web search for "ip address 0.0.0.0" to read more.