Skip to content

[Emulators] Allow overriding emulator ports via CLI flags #10756

Description

@louiskhub

Problem

Emulator ports can currently only be configured statically in the emulators block of firebase.json (or interactively via firebase init emulators). There is no way to set or override a port at invocation time.

This is painful in several common scenarios:

  • CI / parallel test runs: running multiple emulator suites concurrently (e.g. sharded test jobs on one runner) requires generating a distinct firebase.json per shard just to change port numbers.
  • Port collisions on developer machines: when a default port is taken (e.g. macOS AirPlay on 5000, see Hosting emulator defaults to a port that's not open by default in macOS Monterey #3875), the only fix is editing a checked-in config file, which then risks being committed and breaking teammates' setups.

Proposed solution

Per-emulator port flags on emulators:start and emulators:exec that override the corresponding firebase.json values (falling back to config/defaults when omitted), e.g.:

firebase emulators:start \
  --firestore-port 8081 \
  --auth-port 9098 \
  --functions-port 5002 \
  --ui-port 4001 \

Precedence: CLI flag > firebase.json > built-in default.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions