invertase / flutterfire_cli

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

[bug]: { "status": "error", "error": "Timed out." } FormatException: Unexpected character (at line 17, character 2) }{ ^ #282

Closed jingpingye closed 2 months ago

jingpingye commented 2 months ago

Is there an existing issue for this?

CLI Version

1.0.0

Firebase Tools version

13.7.2

Flutter Doctor Output

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! [√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [版本 10.0.16299.522], locale zh-CN) • Flutter version 3.19.5 on channel stable at D:\dev\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

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

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\MI\AppData\Local\Android\sdk • Platform android-34, build-tools 34.0.0 • Java binary at: D:\software\install\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at D:\software\install\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.4) • Visual Studio at D:\software\install\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.9.34714.143 • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.2) • Android Studio at D:\software\install\Android\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 17.0.9+0--11185874)

[√] VS Code, 32-bit edition (version 1.88.1) • VS Code at D:\software\install\Microsoft VS Code • Flutter extension version 3.86.0

[√] Connected device (2 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.16299.522] • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.130

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

• No issues found!

Description

I followed the video to configure my flutter project. When try the command 'flutterfire configure', the terminal console errors as followings.

D:\develop\repo\flutter\github\firebase_test>flutterfire configure
⠸ Fetching available Firebase projects...
Failed to parse JSON response from Firebase CLI. JSON response: {
  "status": "success",
  "result": [
    {
      "projectId": "flash-chat-4898a",
      "projectNumber": "628243728316",
      "displayName": "Flash chat",
      "name": "projects/flash-chat-4898a",
      "resources": {
        "hostingSite": "flash-chat-4898a",
        "realtimeDatabaseInstance": "flash-chat-4898a-default-rtdb"
      },
      "state": "ACTIVE",
      "etag": "1_284c210e-3c25-418f-af81-81869eb80ea7"
    }
  ]
}{
  "status": "error",
  "error": "Timed out."
}
FormatException: Unexpected character (at line 17, character 2)
}{
 ^

Steps to reproduce

  1. create a new flutter project
  2. run the command flutter doctor to make sure flutter is installed well.
  3. run the command npm i firebase-tools -g to install Firebase CLI.
  4. run the command firebase login to login in Firebase.
  5. run the command dart pub global active flutterfire_cli to install Flutterfire CLI.
  6. add pub directory to environment variable.
  7. run the command flutter pub add firebase_core to install firebase_core plugin.
  8. run the command flutterfire configure, error occurs.
    D:\develop\repo\flutter\github\firebase_test>flutterfire configure
    ⠸ Fetching available Firebase projects...
    Failed to parse JSON response from Firebase CLI. JSON response: {
    "status": "success",
    "result": [
    {
      "projectId": "flash-chat-4898a",
      "projectNumber": "628243728316",
      "displayName": "Flash chat",
      "name": "projects/flash-chat-4898a",
      "resources": {
        "hostingSite": "flash-chat-4898a",
        "realtimeDatabaseInstance": "flash-chat-4898a-default-rtdb"
      },
      "state": "ACTIVE",
      "etag": "1_284c210e-3c25-418f-af81-81869eb80ea7"
    }
    ]
    }{
    "status": "error",
    "error": "Timed out."
    }
    FormatException: Unexpected character (at line 17, character 2)
    }{
    ^

Expected behavior

everything okay!

Screenshots

No response

Additional context and comments

The console says 'Timeout', so I test my network speed.

network_speed_test
russellwheatley commented 2 months ago

Closing out as this is a duplicate of: https://github.com/invertase/flutterfire_cli/issues/262

jingpingye commented 2 months ago

Thanks, running the command dart pub global activate flutterfire_cli 0.3.0-dev.18 --overwrite can solve the issue. If you face the same problem, try downgrading flutterfire.

fabrego524 commented 2 months ago

@jingpingye I've been having this issue. Downgrading Flutterfire does not solve it on my end. I made it past the first prompt, but the result ended up the same.

i Found 2 Firebase projects.
✔ Select a Firebase project to configure your Flutter application with · flutter-chat-app-990cf (flutter-chat-app) 
✔ Which platforms should your configuration support (use arrow keys & space to select)? · ios, android
i Firebase android app com.example.chat_app is not registered on Firebase project flutter-chat-app-990cf.
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:list android --json --project=flutter-chat-app-990cf
ERROR: Failed to parse JSON response from Firebase CLI. JSON response: {
  "status": "success",
  "result": []
}{
  "status": "error",
  "error": "Timed out."
}
 Error response: FormatException: Unexpected character (at line 4, character 2)
}{
 ^

Looks like I'll have to wait for the next release