firebase-tools
firebase-tools copied to clipboard
Running `flutterfire reconfigure` returned a `FormatException`
[REQUIRED] Environment info
firebase-tools: 13.11.2
Platform: macOS
[REQUIRED] Test case
I am so sorry, I cannot find reasonable time to provide this...
[REQUIRED] Steps to reproduce
- Have a Flutter project configured with flavours (eg.
staging,production) - Configure Flutter apps (iOS and Android) with Firebase projects (eg.
staging,production)
flutterfire configure \
--project=<redacted> \
--out=lib/firebase/firebase_options_staging.dart \
--android-package-name=<redacted> \
--android-out=android/app/firebase/flavors/staging/google-services.json \
--ios-bundle-id=<redacted> \
--ios-out=ios/firebase/flavors/staging/GoogleService-Info.plist \
--ios-build-config=Debug-staging,Profile-staging,Release-staging
- Addition of Firebase aliases
firebase use --add staging. // association to staging Firebase project
firebase use --add production. // association to production Firebase project
firebase use staging
- Modify
main.dartfile to load appropriatefirebase_options.dartfile
// main.dart file
void main() async {
...
WidgetsFlutterBinding.ensureInitialized();
await initializeFirebaseApp();
...
}
// flavor_config.dart file
import 'package:flutter/services.dart';
import 'firebase/firebase_options_production.dart' as production;
import 'firebase/firebase_options_staging.dart' as staging;
import 'package:firebase_core/firebase_core.dart';
enum Flavor { production, staging; }
Flavor getFlavor() => switch (appFlavor) {
'production' => Flavor.production,
'staging' => Flavor.staging,
_ => throw UnsupportedError(
'Invalid flavor: "$appFlavor".'),
};
Future<void> initializeFirebaseApp() async {
final firebaseOptions = switch (getFlavor()) {
Flavor.production => production.DefaultFirebaseOptions.currentPlatform,
Flavor.staging => staging.DefaultFirebaseOptions.currentPlatform,
};
await Firebase.initializeApp(options: firebaseOptions);
}
- Add
firebase_corepackage to Flutter project:flutter pub add firebase_core - Reconfigure project after previous addition of
firebase_core:flutterfire reconfigure - See the result in the output log:
flutterfire reconfigure
Failed to parse JSON response from Firebase CLI. JSON response: This tool has encountered an error. Please file a bug on Github (https://github.com/firebase/firebase-tools/) and include firepit-log.txt
FormatException: Unexpected character (at character 1)
This tool has encountered an error. Please file a bug on Github (https://gi...
[REQUIRED] Expected behavior
Having the Firebase configuration for current Firebase project alias selected (staging) reconfigured when running flutterfire reconfigure.
[REQUIRED] Actual behavior
- Having the following output log after running
flutterfire reconfigure
Failed to parse JSON response from Firebase CLI. JSON response: This tool has encountered an error. Please file a bug on Github (https://github.com/firebase/firebase-tools/) and include firepit-log.txt
FormatException: Unexpected character (at character 1)
This tool has encountered an error. Please file a bug on Github (https://gi...
- In addition with the creation of the
firepit-log.txtfile in the root folder of my Flutter project
// firepit-log.txt file
Welcome to firepit v1.1.0!
Doing JSON parses for version checks at /snapshot/firepit/vendor/node_modules/firebase-tools/package.json
is-ci,mime,rc,rimraf,yaml,abbrev,abort-controller,accepts,agent-base,aggregate-error,ajv,ajv-formats,ansi-align,ansi-escapes,ansi-regex,ansi-styles,ansicolors,anymatch,archiver,archiver-utils,argparse,array-flatten,arrify,as-array,ast-types,async,async-lock,asynckit,balanced-match,base64-js,basic-auth,basic-auth-connect,basic-ftp,bignumber.js,binary-extensions,bl,body-parser,boxen,brace-expansion,braces,buffer,buffer-crc32,buffer-equal-constant-time,bytes,cacache,call-bind,call-me-maybe,camelcase,cardinal,chalk,chardet,chokidar,chownr,ci-info,cjson,clean-stack,cli-boxes,cli-cursor,cli-spinners,cli-table,cli-table3,cli-width,cliui,clone,color,color-convert,color-name,color-string,colorette,colors,colorspace,combined-stream,commander,compress-commons,compressible,compression,concat-map,config-chain,configstore,connect,content-disposition,content-type,cookie,cookie-signature,core-util-is,cors,crc-32,crc32-stream,cross-env,cross-spawn,crypto-random-string,csv-parse,data-uri-to-buffer,debug,deep-equal-in-any-order,deep-extend,deep-freeze,deep-is,defaults,define-data-property,degenerator,delayed-stream,depd,destroy,discontinuous-range,dot-prop,duplexify,eastasianwidth,ecdsa-sig-formatter,ee-first,emoji-regex,enabled,encodeurl,encoding,end-of-stream,env-paths,err-code,es-define-property,es-errors,escalade,escape-goat,escape-html,escape-string-regexp,escodegen,esprima,estraverse,esutils,etag,event-target-shim,events-listener,exegesis,exegesis-express,exponential-backoff,express,extend,external-editor,fast-deep-equal,fast-json-stable-stringify,fast-url-parser,fecha,figures,filesize,fill-range,finalhandler,firebase-tools,fn.name,foreground-child,form-data,forwarded,fresh,fs-constants,fs-extra,fs-minipass,fs.realpath,function-bind,fuzzy,gaxios,gcp-metadata,get-caller-file,get-intrinsic,get-stdin,get-uri,glob,glob-parent,glob-slash,glob-slasher,global-dirs,google-auth-library,google-gax,googleapis-common,gopd,graceful-fs,gtoken,has-flag,has-property-descriptors,has-proto,has-symbols,has-yarn,hasown,heap-js,http-cache-semantics,http-errors,http-proxy-agent,https-proxy-agent,iconv-lite,ieee754,import-lazy,imurmurhash,indent-string,inflight,inherits,ini,inquirer,inquirer-autocomplete-prompt,install-artifact-from-github,ip-address,ip-regex,ipaddr.js,is-arrayish,is-binary-path,is-extglob,is-fullwidth-code-point,is-glob,is-installed-globally,is-interactive,is-lambda,is-npm,is-number,is-obj,is-path-inside,is-stream,is-stream-ended,is-typedarray,is-unicode-supported,is-url,is-wsl,is-yarn-global,is2,isarray,isexe,isomorphic-fetch,jackspeak,jju,join-path,js-yaml,jsbn,json-bigint,json-parse-helpfulerror,json-ptr,json-schema-traverse,jsonfile,jsonwebtoken,jwa,jws,kuler,lazystream,leven,libsodium,libsodium-wrappers,lodash,lodash._objecttypes,lodash.camelcase,lodash.defaults,lodash.difference,lodash.flatten,lodash.includes,lodash.isboolean,lodash.isinteger,lodash.isnumber,lodash.isobject,lodash.isplainobject,lodash.isstring,lodash.mapvalues,lodash.once,lodash.snakecase,lodash.union,log-symbols,logform,long,lru-cache,make-dir,make-fetch-happen,marked,marked-terminal,media-typer,merge-descriptors,methods,mime-db,mime-types,mimic-fn,minimatch,minimist,minipass,minipass-collect,minipass-fetch,minipass-flush,minipass-pipeline,minipass-sized,minizlib,mkdirp,moo,morgan,ms,mute-stream,nan,nearley,negotiator,netmask,nice-try,node-emoji,node-fetch,node-gyp,nopt,normalize-path,object-assign,object-hash,object-inspect,on-finished,on-headers,once,one-time,onetime,open,openapi3-ts,ora,os-tmpdir,p-defer,p-limit,p-map,p-throttle,pac-proxy-agent,pac-resolver,parseurl,path-is-absolute,path-key,path-scurry,path-to-regexp,pg,pg-cloudflare,pg-connection-string,pg-int8,pg-pool,pg-protocol,pg-types,pgpass,picocolors,picomatch,portfinder,postgres-array,postgres-bytea,postgres-date,postgres-interval,proc-log,process-nextick-args,progress,promise-breaker,promise-retry,proto-list,proto3-json-serializer,protobufjs,proxy-addr,proxy-agent,proxy-from-env,pump,punycode,pupa,qs,railroad-diagrams,randexp,range-parser,raw-body,re2,readable-stream,readdir-glob,readdirp,redeyed,registry-auth-token,registry-url,require-directory,require-from-string,restore-cursor,ret,retry,retry-request,router,run-async,rxjs,safe-buffer,safe-stable-stringify,safer-buffer,semver,semver-diff,send,serve-static,set-function-length,setprototypeof,shebang-command,shebang-regex,side-channel,signal-exit,simple-swizzle,smart-buffer,socks,socks-proxy-agent,sort-any,source-map,split2,sprintf-js,sql-formatter,ssri,stack-trace,statuses,stream-chain,stream-events,stream-json,stream-shift,string-width,string-width-cjs,string_decoder,strip-ansi,strip-ansi-cjs,strip-json-comments,stubs,superstatic,supports-color,supports-hyperlinks,tar,tar-stream,tcp-port-used,teeny-request,text-hex,through,tmp,to-regex-range,toidentifier,toxic,tr46,triple-beam,tslib,type-fest,type-is,typedarray-to-buffer,undici-types,unique-filename,unique-slug,unique-string,universal-analytics,universalify,unpipe,update-notifier-cjs,uri-js,url-join,url-template,util-deprecate,utils-merge,uuid,valid-url,vary,wcwidth,webidl-conversions,whatwg-fetch,whatwg-url,which,widest-line,winston,winston-transport,wrap-ansi,wrap-ansi-cjs,wrappy,write-file-atomic,ws,xdg-basedir,xtend,y18n,yallist,yargs,yargs-parser,yocto-queue,zip-stream,@apidevtools,@colors,@dabh,@google-cloud,@googleapis,@grpc,@isaacs,@js-sdsl,@jsdevtools,@npmcli,@opentelemetry,@pkgjs,@pnpm,@protobufjs,@tootallnate,@types
Installed [email protected] and packaged [email protected]
Checking for npm/bin/npm-cli install at /Users/cyrilledakhlia/.cache/firebase/tools/lib/node_modules/npm/bin/npm-cli
Checking for npm/bin/npm-cli install at /Users/cyrilledakhlia/.cache/firebase/tools/node_modules/npm/bin/npm-cli
Checking for npm/bin/npm-cli install at /snapshot/firepit/node_modules/npm/bin/npm-cli
Found npm/bin/npm-cli install.
Checking for npm/bin/npm-cli install at /Users/cyrilledakhlia/.cache/firebase/tools/lib/node_modules/npm/bin/npm-cli
Checking for npm/bin/npm-cli install at /Users/cyrilledakhlia/.cache/firebase/tools/node_modules/npm/bin/npm-cli
Checking for npm/bin/npm-cli install at /snapshot/firepit/node_modules/npm/bin/npm-cli
Found npm/bin/npm-cli install.
ShellJSInternalError: ENOENT: no such file or directory, chmod '/Users/cyrilledakhlia/.cache/firebase/runtime/node.js'
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
Hi @Cyrille-Dakhlia, sorry to see that you're running into this issue. My best guess right now is that there is a file permissions issue that is breaking things for you. A few things to try:
- Could you run
chmod -R +x /Users/cyrilledakhlia/.cache/firebase/, and then rerun the command? - If that does not work, is there a 'firebase-debug.log' file in your directory that you could share? If not, is there a way to pass in the --debug flag? (Unfortunately, I'm not super familiar with flutterfire and don't really now how it is invoked)
Hey @Cyrille-Dakhlia. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@Cyrille-Dakhlia if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
Started seeing this issue after
flutterfire update
Rebuilding cache by running flutter pub cache repair
helped me to fix this issue