flutterfire_cli
flutterfire_cli copied to clipboard
flutterfire configure, FormatException: Unexpected character (at character 1)
PS C:\Users\HP\Documents\myapp\cas_testing_1\flutter_application_1> flutterfire configure
⠹ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
#
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:96:25)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:115:7)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:184:24)
<asynchronous suspension>
#8 ConfigCommand.run (package:flutterfire_cli/src/commands/config.dart:253:37)
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 main (file:///C:/Users/HP/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutterfire_cli-0.1.3/bin/flutterfire.dart:57:5)
<asynchronous suspension>
⠼ Fetching available Firebase projects...
Unhandled exception:
FormatException: Unexpected character (at character 1)
#
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:96:25)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:115:7)
<asynchronous suspension>
Unhandled exception:
FormatException: Unexpected character (at character 1)
#
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:35:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:96:25)
<asynchronous suspension>
#6 getProjects (package:flutterfire_cli/src/firebase.dart:115:7)
<asynchronous suspension>
#7 ConfigCommand._selectFirebaseProject (package:flutterfire_cli/src/commands/config.dart:184:24)
<asynchronous suspension>
<asynchronous suspension>
#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
7:5)
<asynchronous suspension>
Same here!
Here's my Flutter doctor -v output
[✓] Flutter (Channel stable, 2.10.4, on macOS 11.4 20F71 darwin-x64, locale en-GB) • Flutter version 2.10.4 at /Users/igor/dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500 • Engine revision 57d3bac3dd • Dart version 2.16.2 • DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/igor/Library/Android/sdk • Platform android-31, build-tools 32.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 12.5.1) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.10.1
[✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 51.0.1 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio 2.app/Contents • Flutter plugin version 51.0.1 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.66.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.38.1
[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 11.4 20F71 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.88
[✓] HTTP Host Availability • All required HTTP hosts are available
Same issue here, is there any workaround available?
What helped me in the end was to logout of firebase and login again, you can do that with firebase login --reauth
Thanks
Hi, using the firebase login --reauth didn't solve it for me, did you manage to find a workaround in the meantime?
I have the same issue using Firebase CLI (on Windows). However, when I do this from a regular terminal (actually, my IDEA's terminal, but I guess a command prompt would be the same), it just worked...
firebase tools --version showed me I'm working with 9.2.2.
So I tried to update my version using npm install -g firebase-tools but eventually got an error
(node:10388) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received '' and decided to let it rest for now.
Hope this is helpful for someone else...
I have same isssue when I'm trying to use flutterfire configure in Android Studio terminal.
Interesting thing: when I'm trying the same in standalone cmd prompt I'm getting:
i Found 0 Firebase projects. Selecting project addicts-guardian-7cac9. FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command. COMMAND: firebase --version ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
But I've got installed Firebase CLI, via WSL. I've tried to reinstall npm+node+firebase-tools but without effect. I've even created a new firebase project, to try deal with this issue, I'm able to work with cli, deploy functions etc., but still can't get firebase_options file.
Here's flutter doctor:
"Flutter doctor -v output [√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.19044.1645], locale pl-PL) • Flutter version 2.10.5 at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5464c5bac7 (3 weeks ago), 2022-04-18 09:55:37 -0700 • Engine revision 57d3bac3dd • Dart version 2.16.2 • DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at C:\Users\komputerz\AppData\Local\Android\sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.2) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.10.31410.357 • Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\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 11.0.12+7-b1504.28-7817840)
[√] Connected device (4 available) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1645] • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.54 • Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.32
[√] HTTP Host Availability • All required HTTP hosts are available"
i Found 0 Firebase projects. Selecting project addicts-guardian-7cac9. FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command. COMMAND: firebase --version ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see
Way to solve this one is rename the firebase_windows_xxx.exe to firebase.exe
@robertflesch Thank's Robert, but I've already tried this, not helping. Today I've unistall firbease-tools, node.js and wsl to try install this time throught nvm, but I'm still getting error after flutterfire configure command:
flutterfire configure i Found 0 Firebase projects. Selecting project addicts-guardian-7cac9. FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command. COMMAND: firebase --version ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
firebase --version 10.8.0
I was running into the same issue yesterday, and never got it solved, however I did manage to get my project working. I found that if I created a new project inside the firebase_cli, I could get my app running with the default configuration. And the firebase_options.dart was not needed. using firebase projects:create,
firebase projects:create ? Please specify a unique project id (warning: cannot be modified afterward) [6-30 characters]: myProject ? What would you like to call your project? (defaults to your project ID) myProjectName √ Creating Google Cloud Platform project √ Adding Firebase resources to Google Cloud Platform project
=== Your Firebase project is ready! ===
Project information:
- Project ID: myProject
- Project Name: myProjectName
Firebase console is available at https://console.firebase.google.com/project/ myProject/overview
Hope this helps.
Message ID: @.***>
I've had this issue for a while, just solved it for me.
The key was to not run "flutterfire configure" in the VSCode Terminal, but in the flutterfireCLI Terminal.
Normally when executing "flutterfire configure" in the flutterfireCLI it tells you "FlutterAppRequiredException: The current directory does not appear to be a Flutter application project.", that is because you have to navigate to the correct directory first.
In the FlutterfireCLI Terminal, use "cd" to find your current directory. Then navigate to the directory of your Flutter Project ( The same you should be in currently, in VSCode. From there type "flutterfire configure".
This workaround worked for me, hope it helps.
I've had this issue for a while, just solved it for me.
The key was to not run "flutterfire configure" in the VSCode Terminal, but in the flutterfireCLI Terminal.
Normally when executing "flutterfire configure" in the flutterfireCLI it tells you "FlutterAppRequiredException: The current directory does not appear to be a Flutter application project.", that is because you have to navigate to the correct directory first.
In the FlutterfireCLI Terminal, use "cd" to find your current directory. Then navigate to the directory of your Flutter Project ( The same you should be in currently, in VSCode. From there type "flutterfire configure".
This workaround worked for me, hope it helps.
I tried this but it did not work for me, because the flutterfire was not recognized in my Firebase CLI even though I included the path to my flutterfire CLI in my environment variables. Don't know why it behaves like this.
After going through the flutterfire.bat file in my C:\Users\%USER_NAME%\AppData\Local\Pub\Cache\bin directory, I realized the flutterfire command actually runs this dart command dart pub global run flutterfire_cli:flutterfire. So I copied this and appended the configure command like so dart pub global run flutterfire_cli:flutterfire configure and ran this in my Firebase CLI and it worked.
Hope this helps somebody.
So just come across this issue myself, and wanted to clarify a few things written previously (or propose yet another way that seems to have worked for me). Personally, I think the instructions given for the firebase CLI (+ Flutter integration) by the official documentation could be much clearer.
[This is using the standalone windows firebase-tools-instant-win.exe]
- Download
firebase-tools-instant-win.exefrom FirebaseCLI like normal - Move
firebase-tools-instant-win.exeto the root of your Flutter app - [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe - Run
dart pub global activate flutterfire_clifrom anywhere and addC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\binto your User Path variable - Run
firebase-tools-instant-win.exe(from the root project folder) and login if not done already - Enter
flutterfire configureinto the FirebaseCLI
It seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a firebase.exe file. Whereas for FirebaseCLI to run properly, it self-references a firebase-tools-instant-win.exe file, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break.
Hopefully this helps someone out there.
same here
i solved it by : use olded version of firebase-core (firebase_core: ^1.10.6) and everything will worked
6. flutterfire configure
Thank you. You saved my day
Consegui usando o PowerShell ao inves de outros terminais
So just come across this issue myself, and wanted to clarify a few things written previously (or propose yet another way that seems to have worked for me). Personally, I think the instructions given for the firebase CLI (+ Flutter integration) by the official documentation could be much clearer.
[This is using the standalone windows firebase-tools-instant-win.exe]
- Download
firebase-tools-instant-win.exefrom FirebaseCLI like normal- Move
firebase-tools-instant-win.exeto the root of your Flutter app- [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe- Run
dart pub global activate flutterfire_clifrom anywhere and addC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\binto your User Path variable- Run
firebase-tools-instant-win.exe(from the root project folder) and login if not done already- Enter
flutterfire configureinto the FirebaseCLIIt seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a
firebase.exefile. Whereas for FirebaseCLI to run properly, it self-references afirebase-tools-instant-win.exefile, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break.Hopefully this helps someone out there.
Thanks man, I've struggled with this for more than a week now. Only your solution worked
This solution might be helpful to some here. https://github.com/invertase/flutterfire_cli/issues/27#issuecomment-1443371577
TL;DR
- use latest firebase-tools
- relog
firebasecmd/terminal
its been two days , none of these worked for me . i have tried installing with both CLI and npm method. if i run the "flutterfire configure" from the firebase.exe it gives me this error = "i Found 0 Firebase projects. FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command. COMMAND: firebase --version ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it."
however "firebase projects:list " is working fine .
When i try with running the "flutterfire configure" from the terminal in the same folder instead of the firebase.exe , it gives me the same "unhandeled exception" error which the OP is facing.
i have added path of everything in the environment variables. Also tried updating with the npm commands. i also tried logging in and out , reauth.
Edit : (found a solution) the issue was , i was using the LTS version of node , so after updating it using NVM and reinstalling everything fixed the issue for me. 🙂.
So just come across this issue myself, and wanted to clarify a few things written previously (or propose yet another way that seems to have worked for me). Personally, I think the instructions given for the firebase CLI (+ Flutter integration) by the official documentation could be much clearer.
[This is using the standalone windows firebase-tools-instant-win.exe]
- Download
firebase-tools-instant-win.exefrom FirebaseCLI like normal- Move
firebase-tools-instant-win.exeto the root of your Flutter app- [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe- Run
dart pub global activate flutterfire_clifrom anywhere and addC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\binto your User Path variable- Run
firebase-tools-instant-win.exe(from the root project folder) and login if not done already- Enter
flutterfire configureinto the FirebaseCLIIt seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a
firebase.exefile. Whereas for FirebaseCLI to run properly, it self-references afirebase-tools-instant-win.exefile, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break.Hopefully this helps someone out there.
Thanks for saving my day :D
It was fixed when I downloaded nodejs from its own site and installed it again.
So just come across this issue myself, and wanted to clarify a few things written previously (or propose yet another way that seems to have worked for me). Personally, I think the instructions given for the firebase CLI (+ Flutter integration) by the official documentation could be much clearer.
[This is using the standalone windows firebase-tools-instant-win.exe]
- Download
firebase-tools-instant-win.exefrom FirebaseCLI like normal- Move
firebase-tools-instant-win.exeto the root of your Flutter app- [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe- Run
dart pub global activate flutterfire_clifrom anywhere and addC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\binto your User Path variable- Run
firebase-tools-instant-win.exe(from the root project folder) and login if not done already- Enter
flutterfire configureinto the FirebaseCLIIt seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a
firebase.exefile. Whereas for FirebaseCLI to run properly, it self-references afirebase-tools-instant-win.exefile, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break.Hopefully this helps someone out there.
You don't know how much time I spent trying to solve this problem! thanks a lot man. For those with whom this did not work, make 2 copies of firebase-tools-instant-win.exe in the root of your project, change the name of one of them and run the other one(the original name) and continue the steps above.
I've had this issue for a while, just solved it for me. The key was to not run "flutterfire configure" in the VSCode Terminal, but in the flutterfireCLI Terminal. Normally when executing "flutterfire configure" in the flutterfireCLI it tells you "FlutterAppRequiredException: The current directory does not appear to be a Flutter application project.", that is because you have to navigate to the correct directory first. In the FlutterfireCLI Terminal, use "cd" to find your current directory. Then navigate to the directory of your Flutter Project ( The same you should be in currently, in VSCode. From there type "flutterfire configure". This workaround worked for me, hope it helps.
I tried this but it did not work for me, because the
flutterfirewas not recognized in my Firebase CLI even though I included the path to my flutterfire CLI in my environment variables. Don't know why it behaves like this.After going through the
flutterfire.batfile in myC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\bindirectory, I realized theflutterfirecommand actually runs this dart commanddart pub global run flutterfire_cli:flutterfire. So I copied this and appended theconfigurecommand like sodart pub global run flutterfire_cli:flutterfire configureand ran this in my Firebase CLI and it worked.Hope this helps somebody.
thank you you save my time afte 24hours research :D . your method is work fine for me.
I have the same issue which is,
`$ dart pub global run flutterfire_cli:flutterfire configure ⠧ Fetching available Firebase projects... Unhandled exception: FormatException: Unexpected end of input (at character 1)
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
#1 _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:501:7)
#2 _parseJson (dart:convert-patch/convert_patch.dart:36:10)
#3 JsonDecoder.convert (dart:convert/json.dart:610:36)
#4 runFirebaseCommand (package:flutterfire_cli/src/firebase.dart:95:25)
I have tried all the above solution none of them worked for me. I have been trying for more than 1 week nothing happens. Please Kindly rectify this issue. PLEASE!!!
So just come across this issue myself, and wanted to clarify a few things written previously (or propose yet another way that seems to have worked for me). Personally, I think the instructions given for the firebase CLI (+ Flutter integration) by the official documentation could be much clearer. [This is using the standalone windows firebase-tools-instant-win.exe]
- Download
firebase-tools-instant-win.exefrom FirebaseCLI like normal- Move
firebase-tools-instant-win.exeto the root of your Flutter app- [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe- Run
dart pub global activate flutterfire_clifrom anywhere and addC:\Users\%USER_NAME%\AppData\Local\Pub\Cache\binto your User Path variable- Run
firebase-tools-instant-win.exe(from the root project folder) and login if not done already- Enter
flutterfire configureinto the FirebaseCLIIt seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a
firebase.exefile. Whereas for FirebaseCLI to run properly, it self-references afirebase-tools-instant-win.exefile, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break. Hopefully this helps someone out there.You don't know how much time I spent trying to solve this problem! thanks a lot man. For those with whom this did not work, make 2 copies of firebase-tools-instant-win.exe in the root of your project, change the name of one of them and run the other one(the original name) and continue the steps above.
Thank you so much for your help. I am really appreciate it!
- [IMPORTANT] Duplicate this .exe and rename one copy
firebase.exe
It seems that flutterfire needs to be run inside the FlutterCLI rather than Windows terminal, and is expecting to find a
firebase.exefile. Whereas for FirebaseCLI to run properly, it self-references afirebase-tools-instant-win.exefile, hence the duplicate files. At least for me, simply renaming the FirebaseCLI executable caused it to break.
Thank you! I tried everything else you can find in other tickets or StackOverflow but this was exactly the missing piece.
2024, same issue here