Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
AlanKrueger opened this issue Jan 11, 2025 · 5 comments
Open
1 task done

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

AlanKrueger opened this issue Jan 11, 2025 · 5 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. bug Something isn't working keep open

Comments

@AlanKrueger
Copy link

Is there an existing issue for this?

  • 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<String, dynamic>' in type cast
type 'Null' is not a subtype of type 'Map<String, dynamic>' 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 · <create a new project>     
✔ 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<String, dynamic>' in type cast
type 'Null' is not a subtype of type 'Map<String, dynamic>' 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

@AlanKrueger AlanKrueger added bug Something isn't working triage labels Jan 11, 2025
@russellwheatley
Copy link
Member

Hey @AlanKrueger - have you tried the latest dev version? It has some fixes not on the general release.

dart pub global activate flutterfire_cli 1.0.1-dev.4

Let me know if it is the same outcome.

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed triage labels Jan 13, 2025
@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Jan 13, 2025
@AlanKrueger
Copy link
Author

@russellwheatley sadly, same behavior.

$ dart pub global activate flutterfire_cli 1.0.1-dev.4
Package flutterfire_cli is currently active at version 1.0.0.
Downloading packages... . (1.0s)
  dart_console 1.2.0 (4.1.1 available)
> file 7.0.1 (was 6.1.4)
> flutterfire_cli 1.0.1-dev.4 (was 1.0.0) (1.0.1 available)
> http 1.2.2 (was 0.13.6)
  intl 0.18.1 (0.20.1 available)
> petitparser 6.1.0 (was 6.0.2)
> process 5.0.3 (was 4.2.4)
> pub_updater 0.4.0 (was 0.2.4) (0.5.0 available)
+ web 1.1.0
Building package executables... (6.0s)
Built flutterfire_cli:flutterfire.
Installed executable flutterfire.
Activated flutterfire_cli 1.0.1-dev.4.

$ flutterfire configure
? You have an existing `firebase.json` file and possibly already configured your project for Fir
ebase. Would you prefer to reuse the values in your existing `firebase.json` file to configure y
✔ You have an existing `firebase.json` file and possibly already configured your project for Fir
ebase. 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<String, dynamic>' in type cast
type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast

$ flutterfire --version
1.0.1-dev.4

@github-actions github-actions bot removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Jan 14, 2025
Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@AlanKrueger
Copy link
Author

Thanks for removing the Stale label. It looks like 1.0.1-dev.4 is still the most recent dev version, and it still exhibits the behavior I was seeing. (Just tried it again to be sure.)

@russellwheatley
Copy link
Member

No problem, latest version is v1.1.0 just published. Just double check it hasn't solved your problem as there was a fix for firebase CLI response. If not, I will take a look at this at some point.

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. keep open and removed Needs Attention OP created or responded to issue and it needs attention. labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. bug Something isn't working keep open
Projects
None yet
Development

No branches or pull requests

2 participants