Skip to content

fix(emulator): show the listen address next to the Emulator UI and Hub links - #11407

Merged
joehan merged 3 commits into
firebase:mainfrom
gauranshahuja:6222/ui-banner-listen-address
Nov 3, 2026
Merged

joehan merged 3 commits into
firebase:mainfrom
gauranshahuja:6222/ui-banner-listen-address

Conversation

@gauranshahuja

Copy link
Copy Markdown
Contributor

Description

Fixes #6222.

With "emulators": { "ui": { "host": "0.0.0.0" } }, the Emulator UI listens on 0.0.0.0, but the startup message says View Emulator UI at http://127.0.0.1:4000/, which looks like the setting was ignored. The table's Host:Port column already shows each emulator's real listen address through getListenOverview. The banner link and the "Emulator Hub host:" line go through EmulatorRegistry.url() / getInfo(), which rewrite wildcard hosts with connectableHostname() so the link can be opened.

This keeps the links connectable and prints the listen address next to them when the two differ:

i  View Emulator UI at http://127.0.0.1:4000/ (listening on 0.0.0.0:4000)
...
  Emulator Hub host: 127.0.0.1 port: 4400 (listening on 0.0.0.0:4400)

When an emulator listens on a normal host (127.0.0.1, localhost, a LAN IP), nothing is added, so the default output does not change. The per-emulator "View in Emulator UI" links in the table are unchanged, since they need to be clickable.

The new getListenSuffix() in commandUtils.ts sits next to getListenOverview() and reuses it, so IPv6 wildcards come out bracketed ([::]:4000).

Scenarios Tested

  • commandUtils.spec.ts: getListenSuffix for 0.0.0.0, the IPv6 wildcard ::, hosts that need no suffix (127.0.0.1, a LAN IP), and an emulator that is not running. 15 passing.
  • npx eslint on the three changed files: no errors, and no new warnings on the changed lines.
  • Built this branch and ran firebase emulators:start --project demo-test6222 with the auth emulator, and ui.host and hub.host set to 0.0.0.0 in firebase.json:
┌───────────────────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app.               │
│ i  View Emulator UI at http://127.0.0.1:4000/ (listening on 0.0.0.0:4000) │
└───────────────────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI        │
├────────────────┼────────────────┼────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
└────────────────┴────────────────┴────────────────────────────┘
  Emulator Hub host: 127.0.0.1 port: 4400 (listening on 0.0.0.0:4400)
  Other reserved ports: 4500

Sample Commands

firebase emulators:start with "ui": { "host": "0.0.0.0" } in firebase.json.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the emulator startup messages to display the correct listening address when the Emulator UI or Hub is configured to listen on a wildcard address (such as 0.0.0.0 or ::). It introduces a new helper function getListenSuffix in commandUtils.ts to format the suffix, integrates it into the startup overview command, and adds corresponding unit tests in commandUtils.spec.ts. There are no review comments, so no feedback is provided.

@christhompsongoogle
christhompsongoogle enabled auto-merge (squash) November 3, 2026 19:36
@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@a424338). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/commands/emulators-start.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11407   +/-   ##
=======================================
  Coverage        ?   59.27%           
=======================================
  Files           ?      859           
  Lines           ?    50138           
  Branches        ?    10021           
=======================================
  Hits            ?    29719           
  Misses          ?    18136           
  Partials        ?     2283           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joehan
joehan disabled auto-merge November 3, 2026 23:47
@joehan
joehan merged commit 9eb4cc9 into firebase:main Nov 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

firebase emulator ui does not respect "emulator.ui.host" field in firebase.json

4 participants