You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Emulator UI should not connect to 0.0.0.0 for emulators #286
In firebase.json, it is possible to specify 0.0.0.0 for host for each emulator. This tells an emulator to listen on all IPv4 interfaces (including 127.0.0.1, the device's public network IP, etc.).
However, with this setup, the Emulator UI attempts to send requests http://0.0.0.0:8080 to reach Firestore in the Firestore viewer. This is invalid since 0.0.0.0 is a non-routable address but some browsers / platforms (such as Chrome on Linux) special cases it to mean the same as 127.0.0.1. On other browsers / platforms (such as Chrome on Windows), this fails with errors like net::ERR_ADDRESS_INVALID.
Instead, the Emulator UI should change it to 127.0.0.1 when constructing the URL. Similarly, the Emulator UI should connect to ::1 (IPv6 local) when :: (IPv6 zero) is specified.
@yuchenshi I would like to pick this up. As per my understanding, I think simply changing host to 127.0.0.1 in emulators would make it work. Please correct me if something else also needs to be done.
@gautamsingal Of course! We welcome PRs addressing this. As noted in the last paragraph, please make sure to take care of both 0.0.0.0 and :: for completeness. The best place to make the change is in server.js.
I'm not sure if WSL2 is part of the official supported platforms but I was unable to get any host options working when they work fine elsewhere. Using a configuration like below should work, but the emulator UI and other front-end code can't connect. I would be happy to also help.
That host needs be checked for '0.0.0.0' and '::' If they are they should be changed to "localhost". All this logic is done using json so it makes it a bit more tricky.
I tried doing it quickly, but got stuck getting the development environment going in windows. I was getting an SCSS error about material/theme/mixins and dind't have time to work through it.
@blastdan Was it a issue with node-sass and fsevents by any chance? When setting up Windows environments I commonly need to force a install and rebuild.
@moneal@blastdan I think it's #210 -- a known issue. However, we still haven't found a great cross-platform solution and would appreciate any help there. Either way, let's move the discussion there.
@blastdan Yes! The Emulator UI releases with the Firebase CLI, so you can head to https://github.com/firebase/firebase-tools and click on the Watch dropdown menu and select "Releases only". GitHub will notify you if there is a new release to the Firebase CLI. This will be likely included in the next one or two Firebase CLI versions.
Activity
gautamsingal commentedon Jun 12, 2020
@yuchenshi I would like to pick this up. As per my understanding, I think simply changing host to 127.0.0.1 in emulators would make it work. Please correct me if something else also needs to be done.
yuchenshi commentedon Jun 12, 2020
@gautamsingal Of course! We welcome PRs addressing this. As noted in the last paragraph, please make sure to take care of both
0.0.0.0and::for completeness. The best place to make the change is inserver.js.gautamsingal commentedon Jun 12, 2020
@yuchenshi Thanks! Picking this up
gautamsingal commentedon Jun 18, 2020
@yuchenshi I tried but unable to do. Can you please guide me in this?
moneal commentedon Jun 18, 2020
I'm not sure if WSL2 is part of the official supported platforms but I was unable to get any host options working when they work fine elsewhere. Using a configuration like below should work, but the emulator UI and other front-end code can't connect. I would be happy to also help.
blastdan commentedon Jun 18, 2020
In server.js there are the lines
That host needs be checked for '0.0.0.0' and '::' If they are they should be changed to "localhost". All this logic is done using json so it makes it a bit more tricky.
I tried doing it quickly, but got stuck getting the development environment going in windows. I was getting an SCSS error about material/theme/mixins and dind't have time to work through it.
firebase#286: Emulator UI should not connect to 0.0.0.0 for emulators
firebase#286: Emulator UI should not connect to 0.0.0.0 for emulators
gautamsingal commentedon Jun 18, 2020
@blastdan Thanks for the feedback!
moneal commentedon Jun 18, 2020
@blastdan Was it a issue with
node-sassandfseventsby any chance? When setting up Windows environments I commonly need to force a install and rebuild.yuchenshi commentedon Jun 18, 2020
@moneal @blastdan I think it's #210 -- a known issue. However, we still haven't found a great cross-platform solution and would appreciate any help there. Either way, let's move the discussion there.
firebase#286: Emulator UI should not connect to 0.0.0.0 for emulators
yuchenshi commentedon Jun 18, 2020
Fixed by #312. This will be included in the next release.
blastdan commentedon Jun 18, 2020
@yuchenshi Is there any way to track when a new release is made?
Thanks!
yuchenshi commentedon Jun 18, 2020
@blastdan Yes! The Emulator UI releases with the Firebase CLI, so you can head to https://github.com/firebase/firebase-tools and click on the Watch dropdown menu and select "Releases only". GitHub will notify you if there is a new release to the Firebase CLI. This will be likely included in the next one or two Firebase CLI versions.
yuchenshi commentedon Jul 15, 2020
FYI, this went out with Firebase CLI v8.6.0.
arimwilson commentedon Jun 26, 2021
I am still getting this error using an event listener on the realtime database emulator. See Chrome console errors:
GET http://0.0.0.0:9000/.lp?id=1&pw=cYijYEVq0A&ser=81095532&ns=joydominoes-default-rtdb net::ERR_ADDRESS_INVALID
firebase.json says:
"emulators": {
...
"database": {
"host": "0.0.0.0"
}
...
}
firebase -V says
9.13.1
various hackery to get my database events on the client to work at al…
various hackery to get my database events on the client to work at al…
chbybnwr commentedon Feb 29, 2024
this breaks firebase/firebase-tools#1898