invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug]: FormatException is Thrown while configuring flutter project

stMerlHin opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues.

CLI Version

0.2.7

Firebase Tools version

12.9.1

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.16.0, on Kali GNU/Linux Rolling
6.5.0-kali3-amd64, locale fr_FR.UTF-8)
• Flutter version 3.16.0 on channel stable at /opt/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db7ef5bf9f (il y a 3 semaines), 2023-11-15
11:25:44 -0800
• Engine revision 74d16627b9
• Dart version 3.2.0
• DevTools version 2.28.2

[✓] Android toolchain - develop for Android devices (Android SDK
version 34.0.0)
• Android SDK at /opt/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /opt/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.

[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /usr/bin/chromium

[✓] Linux toolchain - develop for Linux desktop
• Debian clang version 16.0.6 (16)
• cmake version 3.27.7
• ninja version 1.11.1
• pkg-config version 1.8.1

[✓] Android Studio (version 2022.3)
• Android Studio at /opt/android-studio
• Flutter plugin version 75.1.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version openjdk version "17.0.6" 2023-01-17

[✓] IntelliJ IDEA Community Edition (version 2023.2)
• IntelliJ at /opt/idea-IC-232.10072.27
• Flutter plugin version 76.3.4
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Kali GNU/Linux
Rolling 6.5.0-kali3-amd64
• Chrome (web) • chrome • web-javascript • Chromium
119.0.6045.123 built on Debian trixie/sid, running on Debian
kali-rolling

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

• No issues found!

Description

Unhandled exception:
FormatException: Unexpected character (at line 17, character 2)
}{
^

#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:848:48)
#2 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#3 JsonDecoder.convert (dart:convert/json.dart:610:36)
#4 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)

#5 getApps (package:flutterfire_cli/src/firebase.dart:162:20)

#6 findOrCreateFirebaseApp (package:flutterfire_cli/src/firebase.dart:258:34)

#7 FirebaseAndroidOptions.forFlutterApp (package:flutterfire_cli/src/firebase/firebase_android_options.dart:47:25)

#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:399:24)

#9 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#10 main (file:///home/storm/.pub-cache/hosted/pub.dev/flutterfire_cli-0.2.7/bin/flutterfire.dart:57:5)

Steps to reproduce

  1. run flutterfire configure in flutter root project
  2. select project once they are fetched
  3. select all platforms (By default all are selected, just press enter at this level)
  4. Format exception will be thrown

Expected behavior

The cli should successfully add necessary dependencies and firebase file to project.

Screenshots

No response

Additional context and comments

No response

I think this error is not due to the CLI itself. I've upgraded to 0.3.0-dev.18. When I run flutterfire configure, I got an output from which a noticed these lines { "status": "error", "error": "Timed out." }. I took a look at firebase-tools repo and saw that timeout out error can occur in specific version combination of firebase tools and node.

My workaround

upgrade flutterfire CLI to 0.3.0-dev.18
Upgrade node version to v21.3.0
Downgrade firebase-tools to 11.2.2

I probably wouldn't downgrade the firebase-tools version, one of the later versions contains a fix for large JSON outputs. I would also continue to use FFCLI 0.3.0-dev.18 as this is the latest version with many fixes over version 0.2.7. Nothing more to action on this one, thank you for the report 👍

Thanks a lot @stMerlHin for putting up with versions, I have been stuck with this issue since last week. Tried using the versions you specified and it worked!