firebase-tools: 7.13.1
Platform: Windows 10
firebase init
Well, firebase init?
I just want to init the Firebase project...
There was error while firebase init.
Debug log:
Q:\Projects\FlyParks>firebase init --debug
[2020-02-21T10:37:56.895Z] ----------------------------------------------------------------------
[2020-02-21T10:37:56.898Z] Command: C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\firebase-tools\lib\bin\firebase.js init --debug
[2020-02-21T10:37:56.899Z] CLI Version: 7.13.1
[2020-02-21T10:37:56.899Z] Platform: win32
[2020-02-21T10:37:56.900Z] Node Version: v12.16.0
[2020-02-21T10:37:56.901Z] Time: Fri Feb 21 2020 11:37:56 GMT+0100 (GMT+01:00)
[2020-02-21T10:37:56.901Z] ----------------------------------------------------------------------
[2020-02-21T10:37:56.902Z]
[2020-02-21T10:37:57.091Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-02-21T10:37:57.203Z] > authorizing via signed-in user
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
Q:\Projects\FlyParks
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Database: Deploy Firebase Realtime Database Rules, Firestore: Deploy rules and create indexes for Firestore, Functions: Configure and deploy Cloud Functions, Hosting: Configure and deploy Firebase Hosting sites, Storage: Deploy Cloud Storage security rules, Emulators: Set up local emulators for Firebase features
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
[2020-02-21T10:38:05.094Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects?pageSize=100
[2020-02-21T10:38:05.472Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 21 Feb 2020 10:38:03 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
? Select a default Firebase project for this directory: flyparks-pl (FlyParks)
i Using project flyparks-pl (FlyParks)
=== Database Setup
Firebase Realtime Database Rules allow you to define how your data should be
structured and when your data can be read from and written to.
? What file should be used for Database Rules? database.rules.json
? File database.rules.json already exists. Do you want to overwrite it with the Database Rules for flyparks-pl from the Firebase Console? Yes
[2020-02-21T10:38:11.413Z] >>> HTTP REQUEST GET https://flyparks-pl.firebaseio.com/.settings/rules.json
[2020-02-21T10:38:12.037Z] <<< HTTP RESPONSE 200 server=nginx, date=Fri, 21 Feb 2020 10:38:09 GMT, content-type=application/json; charset=utf-8, content-length=161, connection=keep-alive, access-control-allow-origin=*, cache-control=no-cache, strict-transport-security=max-age=31556926; includeSubDomains; preload
+ Database Rules for flyparks-pl have been downloaded to database.rules.json.
Future modifications to database.rules.json will update Database Rules when you run
firebase deploy.
=== Firestore Setup
[2020-02-21T10:38:12.150Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-02-21T10:38:12.368Z] > authorizing via signed-in user
[2020-02-21T10:38:12.369Z] [iam] checking project flyparks-pl for permissions ["firebase.projects.get"]
[2020-02-21T10:38:12.369Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/flyparks-pl:testIamPermissions
permissions=[firebase.projects.get]
[2020-02-21T10:38:13.300Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 21 Feb 2020 10:38:11 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=815, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.
? What file should be used for Firestore Rules? firestore.rules
? File firestore.rules already exists. Do you want to overwrite it with the Firestore Rules from the Firebase Console? Yes
[2020-02-21T10:38:22.083Z] >>> HTTP REQUEST GET https://firebaserules.googleapis.com/v1/projects/flyparks-pl/releases?pageSize=10&pageToken=
[2020-02-21T10:38:23.179Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Fri, 21 Feb 2020 10:38:21 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
[2020-02-21T10:38:23.182Z] No rulesets found, using default.
Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.
? What file should be used for Firestore indexes? firestore.indexes.json
[2020-02-21T10:38:25.776Z] >>> HTTP REQUEST GET https://firestore.googleapis.com/v1beta2/projects/flyparks-pl/databases/(default)/collectionGroups/-/indexes
[2020-02-21T10:38:25.777Z] >>> HTTP REQUEST GET https://firestore.googleapis.com/v1beta2/projects/flyparks-pl/databases/(default)/collectionGroups/-/fields?filter=indexConfig.usesAncestorConfig=false
[2020-02-21T10:38:25.946Z] <<< HTTP RESPONSE 400 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Fri, 21 Feb 2020 10:38:23 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
[2020-02-21T10:38:26.027Z] <<< HTTP RESPONSE BODY code=400, message=This operation is not available for Cloud Firestore projects in Datastore Mode., status=FAILED_PRECONDITION
[2020-02-21T10:38:26.034Z] <<< HTTP RESPONSE 400 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Fri, 21 Feb 2020 10:38:23 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
[2020-02-21T10:38:26.125Z] <<< HTTP RESPONSE BODY code=400, message=This operation is not available for Cloud Firestore projects in Datastore Mode., status=FAILED_PRECONDITION
[2020-02-21T10:38:26.197Z] FirebaseError: HTTP Error: 400, This operation is not available for Cloud Firestore projects in Datastore Mode.
at module.exports (C:\Program Files\nodejs\node_modules\firebase-tools\lib\responseToError.js:38:12)
at Request._callback (C:\Program Files\nodejs\node_modules\firebase-tools\lib\api.js:39:35)
at Request.self.callback (C:\Program Files\nodejs\node_modules\firebase-tools\node_modules\request\request.js:185:22)
at Request.emit (events.js:321:20)
at Request.EventEmitter.emit (domain.js:482:12)
at Request.<anonymous> (C:\Program Files\nodejs\node_modules\firebase-tools\node_modules\request\request.js:1154:10)
at Request.emit (events.js:321:20)
at Request.EventEmitter.emit (domain.js:482:12)
at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\firebase-tools\node_modules\request\request.js:1076:12)
at Object.onceWrapper (events.js:427:28)
at IncomingMessage.emit (events.js:333:22)
at IncomingMessage.EventEmitter.emit (domain.js:482:12)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Error: Error fetching Firestore indexes
Q:\Projects\FlyParks>
@PsychoXIVI thanks for the logs! The error is here:
[2020-02-21T10:38:26.197Z] FirebaseError: HTTP Error: 400, This operation is not available for Cloud Firestore projects in Datastore Mode.
This is a bug, we should catch this configuration earlier. The Firebase CLI is only useful for Firestore in Native mode, not Datastore mode. For now you can get around this by using firebase init but not selecting Firestore as one of your projects.
@PsychoXIVI thanks for the logs! The error is here:
[2020-02-21T10:38:26.197Z] FirebaseError: HTTP Error: 400, This operation is not available for Cloud Firestore projects in Datastore Mode.This is a bug, we should catch this configuration earlier. The Firebase CLI is only useful for Firestore in Native mode, not Datastore mode. For now you can get around this by using
firebase initbut not selecting Firestore as one of your projects.
So, we have to not select Firestore as one of our projects to this bug does not appear?
When you run firebase init it will ask which features you want to initialize:

To work around this issue, you should not select "Firestore" from the list.
But, we can still use the Firestore cli features, right? We just have to do what initialization would do manually?
@willhaslett which features are you referring to? The Firebase CLI is designed to work with Firestore in Native mode. For Datastore mode you almost definitely want to use the gcloud CLI.
My bad. Missed the distinction somehow. All set.
Just go to gcloud console and switch back to Native mode in datastore / firestore. then run this command again all works.
Can confirm that @ahsanghalib's solution works
FYI I did switch to Firestore mode before seeing this problems.

My work around is
foo data.firebase init again.and it work now.
Just go to gcloud console and switch back to Native mode in datastore / firestore. then run this command again all works.
This worked for me.
hello
there is no solution for this problem?
Just go to gcloud console and switch back to Native mode in datastore / firestore. then run this command again all works.
amigos la solucion esta aqui
solo hagan esto en su consola de firebase y ya
muchas gracias
hello
there is no solution for this problem?
I found the problem, is that in Firestore you have to use this path collection/doc/collection/doc
[REQUIRED] Environment info
firebase-tools: 8.1.1
Platform: macOS Catelina v10.15.4
[REQUIRED] Test case
firebase init
[REQUIRED] Steps to reproduce
firebase init
[REQUIRED] Expected behavior
I just want to init the Firebase project
[REQUIRED] Actual behavior
There was error while firebase init at this point:
? What file should be used for Firestore indexes? firestore.indexes.json
Error: Error fetching Firestore indexes
$ firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
<my directory>
? Which Firebase CLI features do you want to set up for this folder? Press Space
to select features, then Enter to confirm your choices. Database: Deploy Firebase
Realtime Database Rules, Firestore: Deploy rules and create indexes for Firestor
e, Functions: Configure and deploy Cloud Functions, Hosting: Configure and deploy
Firebase Hosting sites
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
? Select a default Firebase project for this directory: chat-app-92011 (chat-app)
i Using project chat-app-92011 (chat-app)
=== Database Setup
Firebase Realtime Database Rules allow you to define how your data should be
structured and when your data can be read from and written to.
? What file should be used for Database Rules? database.rules.json
? File database.rules.json already exists. Do you want to overwrite it with the D
atabase Rules for chat-app-92011 from the Firebase Console? Yes
✔ Database Rules for chat-app-92011 have been downloaded to database.rules.json.
Future modifications to database.rules.json will update Database Rules when you run
firebase deploy.
=== Firestore Setup
Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.
? What file should be used for Firestore Rules? firestore.rules
? File firestore.rules already exists. Do you want to overwrite it with the Fires
tore Rules from the Firebase Console? Yes
Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.
? What file should be used for Firestore indexes? firestore.indexes.json
Error: Error fetching Firestore indexes
$
Hello. Newbie to Firebase here and getting the same error. What is the solution for this? Can I use DataStore and Firestore, and how do I do this? Not tally following the solutions above. Thank you!
Tried these 2 and they did not work:
1.
Just go to gcloud console and switch back to Native mode in datastore / firestore. then run this command again all works.
2.
go to https://console.cloud.google.com/firestore/data
create some foo data.
firebase init again.
I found the problem, is that in Firestore you have to use this path collection/doc/collection/doc
hii to all now i got fixed this error just goto this link
https://console.cloud.google.com/firestore/data
and change database to native and set path to collection\doc\collection\doc in the up of start collections....
hii to all now i got fixed this error just goto this link
https://console.cloud.google.com/firestore/data
and change database to native and set path to collection\doc\collection\doc in the up of start collections....
Looks like once you choose Firestore, you cannot switch database to Native:
Warning: Once you select Firestore in Datastore mode and execute the first write on the database, you cannot switch to Firestore in Native mode.
I also had the same problem, but turning on debugging revealed the answer:
FirebaseError: HTTP Error: 403, The Cloud Firestore API has not been used in project join-our-line before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=join-our-line and then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Also having the same problem in May 2020. Removed firestore from init and it worked, but obviously that's not a solution for many people.
I got this problem and I did not ever put datastore into "datastore" mode.
Hey everyone we have been digging into this over the past day or two and there's clearly an issue within the Firebase console. It seems that some old projects in which Firestore was never used are being marked as having Firestore in Datastore Mode (rather than having nothing).
It's not something you need to worry about (you can just switch it over) but it is something we want to fix quickly because it's a bad experience. I will post an update here when I have one.
What's the difference between Native mode and Datastore mode?
@PeterBocan completely different API surface and features:
https://cloud.google.com/datastore/docs/firestore-or-datastore
I believe this should be fixed by #2271 which will be included in the next release of the CLI. The error should now appear like this:
Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/${PROJECT_ID}/database to create your Cloud Firestore database.
The reason for this error is that using Firestore requires making some permanent choices that the CLI can't make for you:
So you need to make these choices in the console before initializing with the CLI.
Most helpful comment
Just go to gcloud console and switch back to Native mode in datastore / firestore. then run this command again all works.