Skip to content

[bug]: FlutterFire CLI overwrites iOS/macOS firebase.json build configs without flavor support (Debug-dev, etc.) #389

Open
@romain-pattyn

Description

@romain-pattyn

Is there an existing issue for this?

  • I have searched the existing issues.

CLI Version

1.2.0

Firebase Tools version

14.1.0

Flutter Doctor Output

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.29.2, on macOS 15.1 24B83 darwin-arm64, locale en-US)
! Warning: dart on your path resolves to /opt/homebrew/Cellar/dart/3.6.1/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
/Users/romainpattyn/fvm/versions/3.29.2. Consider adding /Users/romainpattyn/fvm/versions/3.29.2/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.98.2)
[✓] Connected device (5 available)
! Error: Browsing on the local area network for iPhone de Romain. Ensure the device is unlocked and attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 1 category.

Description

We've encountered a persistent issue when using the flutterfire configure command in projects with multiple environments (flavors) like dev, stag, and prod.

The Problem

We use flavored build configurations in Xcode, such as:

  • Debug-dev, Release-dev
  • Debug-stag, Release-stag
  • Debug-prod, Release-prod

When running:

flutterfire configure \
  --project=example-project-id \
  --out=lib/firebase_options_stag.dart \
  --platforms=ios,macos \
  --ios-bundle-id=com.example.projectName.stag \
  --ios-out=ios/flavors/stag/GoogleService-Info.plist \
  --ios-build-config=Debug \
  --macos-bundle-id=com.example.projectName.stag \
  --macos-out=macos/flavors/stag/GoogleService-Info.plist \
  --macos-build-config=Debug \
  --overwrite-firebase-options \
  --yes

The CLI only writes the iOS/macOS config under the non-flavored Debug key, like this:

"ios": {
  "buildConfigurations": {
    "Debug": {
      "projectId": "...",
      "fileOutput": "ios/flavors/stag/GoogleService-Info.plist"
    }
  }
}

This ignores our flavor-based configurations (e.g. Debug-stag), which causes misalignment between Xcode build schemes and Firebase service injection, especially during release builds.

Our Workaround

We currently use a script to patch firebase.json after CLI execution:

if (buildConfigs.containsKey('Debug')) {
  final debugConfig = buildConfigs.remove('Debug');
  buildConfigs['Debug-stag'] = debugConfig;
  buildConfigs['Release-stag'] = debugConfig;
  buildConfigs['Profile-stag'] = debugConfig;
}

This works — but it feels like a fragile solution. We're unsure if this is:

  • The intended behavior of the CLI
  • A known limitation
  • Or whether we’re missing a more correct way to handle this

Questions

  • Is support for flavored Xcode build configs (Debug-dev, Release-stag, etc.) expected to be handled manually like this?
  • Should we avoid using flavor-specific names and stick with Debug, Release, etc.?
  • Would you consider supporting flavor mapping directly in the CLI?
  • Is this something you're already tracking or planning to improve?

Steps to reproduce

  1. Create a FlutterFire project with iOS/macOS support and Xcode schemes using flavored build configs (e.g. Debug-stag, Release-stag)
  2. Run the flutterfire configure command
  3. Observe the output firebase.json
  4. Try to run a flavored build — Firebase service files won’t be recognized

Expected behavior

The CLI should either:

  • Recognize and allow flavored build configs like Debug-stag, Release-stag, etc.

OR

  • Provide a documented way to map Debug → Debug-stag, etc. automatically.

Screenshots

No response

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions