firebase-tools: firebase init firestore not work with existing project

DESCRIPTION

work very well with version 10.0.1

firebase login --no-localhost

**version 10.0.1 **

open https://accounts.google.com/o/oauth2

** version 10.2.2 **

open https://auth.firebase.tools/login?code=

[REQUIRED] Environment info

firebase-tools: 10.2.2

Platform: ubuntu 20

[REQUIRED] Test case

Screenshot at Mar 04 9-45-54 PM

[REQUIRED] Steps to reproduce

firebase login --no-localhost

firebase init firestore

[REQUIRED] Expected behavior

create firebase.rules file

[REQUIRED] Actual behavior

Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/<PROJECT-ID>/firestore to create your Cloud Firestore database.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 56 (3 by maintainers)

Most upvoted comments

For me this was resolved by setting the “Default GCP resource location” under Project settings (which it forced me to set to the location of the Firestore database)

For me this was resolved by setting the “Default GCP resource location” under Project settings (which it forced me to set to the location of the Firestore database)

Dude, you are a hero! I was stuck on this so long.

More details: go to firebase / project settings (gear icon on the left) / your project / there you can set the default GCP

Also experiencing this issue

Recreating the project via the firebase cli didn’t work unfortunately, still running into the same issue: Error: It looks like you haven't used Cloud Firestore in this project before

Firestore setup/populated and Blaze billing enabled on everything

The only way for me to finish the firebase init command was to pick “Don’t set up a default project” and then run firebase use --add [project-id]

Yep same issue. If I click the link it takes me to my database (which does exist, thank you very much.) If I use --debug, I get a 404 thing:

[2022-11-10T16:48:25.510Z] error getting database typeHTTP Error: 404, App does not exist. {“name”:“FirebaseError”,“children”:[],“context”:{“body”:{“error”:{“code”:404,“message”:“App does not exist.”,“status”:“NOT_FOUND”}},“response”:{“statusCode”:404}},“exit”:1,“message”:“HTTP Error: 404, App does not exist.”,“status”:404}

I have this issue using latest firebase-tools as of today, --no-localhost doesn’t help.

new local firebase project trying to connect to a new (an hour or so old) firebase project with Blaze billing enabled, web project created and firestore created/enabled.

debug logs:

[2022-11-08T23:06:27.479Z] <<< [apiv2][body] GET https://appengine.googleapis.com/v1/apps/XXXXX {"error":{"code":404,"message":"App does not exist.","status":"NOT_FOUND"}}
[2022-11-08T23:06:27.481Z] error getting database typeHTTP Error: 404, App does not exist. {"name":"FirebaseError","children":[],"context":{"body":{"error":{"code":404,"message":"App does not exist.","status":"NOT_FOUND"}},"response":{"statusCode":404}},"exit":1,"message":"HTTP Error: 404, App does not exist.","status":404}
[2022-11-08T23:06:27.483Z] database_type: undefined

(project id redacted)

I think it’s not possible to update the default GCP location anymore. I personally fixed it after upgrading the firebase-tools cli

If it doesn’t work when you install a specific version, you can install latest version. If you didn’t install it “global”, go into the project folder you created and use the 2 codes below npm uninstall firebase npm uninstall firebase-tools

Also, execute the following two codes regardless of whether they are global or not npm uninstall -g firebase npm uninstall -g firebase-tools

and install latest version following two codes npm install firebase (in the project folder) npm install -g firebase-tools

before command “firebase init” open your firebase console at the browser and move bulid -> Firestore Database(in my case) -> click “make Database”(maybe) and check GCP location and command “firebase init”

I think setting firebase console before command firebase init is important

I also had to create a Storage bucket in that default location, after that I could ran the command.

For me this was resolved by setting the “Default GCP resource location” under Project settings (which it forced me to set to the location of the Firestore database)

Amazing! THANK YOU!

I have this same issue. When I try to set Default GCP resource location I get the error message below, with the following error messages in the browser console.

image image

This seem to be a degration occurred from v10.2.0, from which some OAuth scopes are missing compared to login without --no-localhost option.

The images I attached are taken after clicking ‘Done’.

On Fri, 16 Dec 2022, 18:10 Valentin Degenne, @.***> wrote:

@kpgarrod https://github.com/kpgarrod What’s the problem? Just click “done” and it will set it for you.

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/4254#issuecomment-1355235416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQOHEKQHJFAPJT3WHLKCJLWNSPABANCNFSM5P7CDQPQ . You are receiving this because you were mentioned.Message ID: @.***>

For me this was resolved by setting the “Default GCP resource location” under Project settings (which it forced me to set to the location of the Firestore database)

THIS WORKED!!