firebase-tools-ui: Emulator UI should not connect to 0.0.0.0 for emulators

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.).

{
  // ...
  "emulators": {
    "firestore": {"host": "0.0.0.0", "port": 8080},
  }
}

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@moneal @blastdan I think it’s https://github.com/firebase/firebase-tools-ui/issues/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.

@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.