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]: Unhandled exception: FormatException: Unterminated string #145

Closed hwr12 closed 11 months ago

hwr12 commented 1 year ago

Is there an existing issue for this?

CLI Version

0.2.7

Firebase Tools version

11.22.0

Flutter Doctor Output

[!] Flutter (Channel master, 3.6.0-12.0.pre, on macOS 13.0.1 22A400 darwin-arm64, locale ko-KR)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/hyeonrue/Documents/flutter. Consider adding
      /Users/hyeonrue/Documents/flutter/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
[✓] VS Code (version 1.74.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Description

I get the error below.


FormatException: Unterminated string (at line 5, character 434)
...       \"package_name\": \"com.limmoksu.bappa\"\n        }\n      },\n
                                                                              ^

#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      getAppSdkConfig (package:flutterfire_cli/src/firebase.dart:198:20)
<asynchronous suspension>
#6      FirebaseAndroidOptions.forFlutterApp (package:flutterfire_cli/src/firebase/firebase_android_options.dart:55:26)
<asynchronous suspension>
#7      ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:399:24)
<asynchronous suspension>
#8      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#9      main (file:///Users/hyeonrue/.pub-cache/hosted/pub.dartlang.org/flutterfire_cli-0.2.7/bin/flutterfire.dart:57:5)
<asynchronous suspension>```

### Steps to reproduce

flutterfire configure

### Expected behavior

running `flutterfire configure` command should run without errors.

### Screenshots

_No response_

### Additional context and comments

I've searched all the related issues available but can't seem to find a solution. The part that invokes error is maybe when parsing the google-services.json since 'package_name' is included in the error strings.
hwr12 commented 1 year ago

After trying for few days I haven't found any solution yet. But a walkaround of this is just doing it in a native way. For android, placing Google-Service.json in the android/app directory and initializing firebase in main.dart would work.

russellwheatley commented 11 months ago

Try the latest version of FlutterFire:

dart pub global activate flutterfire_cli 0.3.0-dev.18 --overwrite 

and also update to the latest version of Firebase CLI - npm i -g firebase-tools which includes a fix for large JSON file output.