invertase / invertase/flutterfire_cli

[bug]: flutterfire configure fails on reusing firebase.json

Open
#353 6 comments 0 reactions 0 assignees View on GitHub
blocked: customer-response bug keep open
Dominant language
Dart
Stars
193
Forks
74
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues.

### CLI Version

1.0.0

### Firebase Tools version

13.29.0

### Flutter Doctor Output

[√] Flutter (Channel stable, 3.27.1, on Microsoft Windows [Version 10.0.22631.4602], locale en-US)
• Flutter version 3.27.1 on channel stable at C:\Users\thukt\scoop\apps\flutter\3.27.1
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (4 weeks ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\thukt\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:\Users\thukt\AppData\Local\Programs\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.12.35527.113
• Windows 10 SDK version 10.0.26100.0

[√] Android Studio (version 2024.2)
• Android Studio at C:\Users\thukt\AppData\Local\Programs\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] VS Code (version 1.96.2)
• VS Code at C:\Users\thukt\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0

[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version
10.0.22631.4602]
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.206
• Edge (web) • edge • web-javascript • Microsoft Edge 131.0.2903.112

[√] Network resources
• All expected network resources are available.

• No issues found!

### Description

Each time I try to run `flutterfire configure` on this project to refresh configuration, I have to start from scratch. What I try to reuse the values in `firebase.json`, I get the following error:

```
$ flutterfire configure
? You have an existing `firebase.json` file and possibly already configured your project for Firebas
e. Would you prefer to reuse the values in your existing `firebase.json` file to configure your proj
✔ You have an existing `firebase.json` file and possibly already configured your project for Firebas
e. Would you prefer to reuse the values in your existing `firebase.json` file to configure your project? · yes
Failed to write android google-services.json file write for default service file. Please report this
issue at:https://github.com/invertase/flutterfire_cli. Exception: type 'Null' is not a subtype of type 'Map' in type cast
type 'Null' is not a subtype of type 'Map' in type cast
```

If I say `no` and `yes` to overwrite, then follow the prompts and re-enter what I've previously entered, things work correctly.

### Steps to reproduce

I can recreate this with a fresh project and doing `flutterfire configure` twice in a row.

```
$ flutter create flutterfire_minimal
[...]

$ cd flutterfire_minimal
[...]

$ flutterfire config
i Found 1 Firebase projects.
✔ Select a Firebase project to configure your Flutter application with ·
✔ Enter a project id for your new Firebase project (e.g. my-cool-project) · flutterfire-minimal
i New Firebase project flutterfire-minimal created successfully.
✔ Which platforms should your configuration support (use arrow keys & space to select)? · android, ios, web
? Which Android application id (or package name) do you want to use for this configuration, e.g. 'co
✔ Which Android application id (or package name) do you want to use for this configuration, e.g. 'com.example.app'? · com.example.flutterfire.example
i Firebase android app com.example.flutterfire.example is not registered on Firebase project flutterfire-minimal.
i Registered a new Firebase android app on Firebase project flutterfire-minimal.
i Firebase ios app com.example.flutterfireMinimal is not registered on Firebase project flutterfire-minimal.
i Registered a new Firebase ios app on Firebase project flutterfire-minimal.
i Firebase web app flutterfire_minimal (web) is not registered on Firebase project flutterfire-minimal.
i Registered a new Firebase web app on Firebase project flutterfire-minimal.
[...]

$ flutterfire config
? You have an existing `firebase.json` file and possibly already configured your project for Firebas
e. Would you prefer to reuse the values in your existing `firebase.json` file to configure your proj
✔ You have an existing `firebase.json` file and possibly already configured your project for Firebas
e. Would you prefer to reuse the values in your existing `firebase.json` file to configure your project? · yes
Failed to write android google-services.json file write for default service file. Please report this
issue at:https://github.com/invertase/flutterfire_cli. Exception: type 'Null' is not a subtype of type 'Map' in type cast
type 'Null' is not a subtype of type 'Map' in type cast
```

Results of this pushed to https://github.com/AlanKrueger/flutterfire_minimal with individual commits for each step.

### Expected behavior

Not to receive a type error and for the configure command to reuse the previously-entered information.

### Screenshots

_No response_

### Additional context and comments

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.