invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
171 stars 47 forks source link

[bug]: exception when running configure while having large number of projects #136

Closed segevsh closed 1 year ago

segevsh commented 1 year ago

Is there an existing issue for this?

CLI Version

0.2.7

Firebase Tools version

11.16.1

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.3.8, on macOS 12.1 21C52 darwin-x64, locale en-US) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) ✗ cmdline-tools component is missing Run path/to/sdkmanager --install "cmdline-tools;latest" See https://developer.android.com/studio/command-line for more details. ✗ Android license status unknown. Run flutter doctor --android-licenses to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/macos#android-setup for more details. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.73.1) [✓] Connected device (3 available) [✓] HTTP Host Availability

Description

When I'm running flutterfire configure --project=<project id> I'm getting an error message:

⠼ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unterminated string (at line 2045, character 8)
      "
       ^

#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1      _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:494:9)
#2      _parseJson (dart:convert-patch/convert_patch.dart:36:10)
#3      JsonDecoder.convert (dart:convert/json.dart:612:36)
#4      runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
<asynchronous suspension>
#5      getProjects (package:flutterfire_cli/src/firebase.dart:114:20)
<asynchronous suspension>
#6      ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:300:24)
<asynchronous suspension>
#7      ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:390:37)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#9      main (file:///Users/segevs/.pub-cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.7/bin/flutterfire.dart:57:5)
<asynchronous suspension>

I tracked it down to an issue with the text being truncated before JSON deserializes it, hence the issue consistency in line 2045.

Seems like one easy fix would be not to run firebase projects:list when the project id is already provided

Steps to reproduce

  1. run flutterfire configure --project=.... - happens when you have a large number of projects.

Expected behavior

  1. it should complete the flutter init.
  2. it shouldn't fetch list of projects if it doesn't need it (when project id is provided)
  3. it should handle large workspace with many projects.

Screenshots

No response

Additional context and comments

No response

russellwheatley commented 1 year ago

Closing this one out in favour of the issue with the most thumbs up: https://github.com/invertase/flutterfire_cli/issues/150