flutterfire_cli icon indicating copy to clipboard operation
flutterfire_cli copied to clipboard

[bug]: Unhandled exception: type 'Null' is not a subtype of type 'String' in type cast

Open krjw-eyev opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

CLI Version

0.2.2+2

Firebase Tools version

11.2.0

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.0.3, on macOS 12.4 21F79 darwin-arm, locale en-GB) • Flutter version 3.0.3 at /Users/user/dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 676cefaaff (9 days ago), 2022-06-22 11:34:49 -0700 • Engine revision ffe7b86a1e • Dart version 2.17.5 • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/user/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • 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 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.68.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.42.0

[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability • All required HTTP hosts are available

• No issues found!

Description

When running flutterfire configureor flutter configure --project=<id> I get the following:

⠸ Fetching available Firebase projects...
Unhandled exception:
type 'Null' is not a subtype of type 'String' in type cast
#0      new FirebaseProject.fromJson (package:flutterfire_cli/src/firebase/firebase_project.dart:57:44)
#1      getProjects.<anonymous closure> (package:flutterfire_cli/src/firebase.dart:119:29)
#2      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
#3      ListIterator.moveNext (dart:_internal/iterable.dart:342:26)
#4      WhereIterator.moveNext (dart:_internal/iterable.dart:438:22)
#5      new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
#6      new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#7      new List.of (dart:core-patch/array_patch.dart:51:28)
#8      Iterable.toList (dart:core/iterable.dart:470:12)
#9      getProjects (package:flutterfire_cli/src/firebase.dart:122:8)
<asynchronous suspension>
#10     ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:264:24)
<asynchronous suspension>
#11     ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:351:37)
<asynchronous suspension>
#12     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#13     main (file:///Users/user/.pub-cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.2+2/bin/flutterfire.dart:57:5)
<asynchronous suspension>

I have logged into firebase via firebase login and I have also tried to reauth.

Steps to reproduce

  1. run flutterfire configure

Expected behavior

Configure my project

Screenshots

No response

Additional context and comments

firebase projects:list works as expected.

firebase projects:list --json works as expected, which is called internally if I am not mistaken

krjw-eyev avatar Jul 01 '22 11:07 krjw-eyev

I had a project without a displayName so the json was not able to be parsed correctly. I don't know if displayName is required nowadays but apparently it wasn't when I created the project.

krjw-eyev avatar Jul 01 '22 18:07 krjw-eyev