-
Notifications
You must be signed in to change notification settings - Fork 964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase init firestore not work with existing project #4254
Comments
Have you enabled Cloud Firestore on your existing project before you tried this? If so, this is definitely a bug or a permission issue (and please let us know if you're using a non-Admin account or service account). If not, please follow the link which explains about setting up Firestore. |
Yes, I created my firestore database one month ago. |
To confirm the type of issue, can you run the command with |
[2022-03-08T19:10:53.980Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2022-03-08T19:10:53.980Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[2022-03-08T19:10:54.537Z] <<< HTTP RESPONSE 400 {"cache-control":"no-cache, no-store, max-age=0, must-revalidate","date":"Tue, 08 Mar 2022 19:10:54 GMT","expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2022-03-08T19:10:54.539Z] >>> HTTP REQUEST GET https://appengine.googleapis.com/v1/apps/eventos-staging-93d3a
[2022-03-08T19:10:55.280Z] <<< HTTP RESPONSE 401 {"www-authenticate":"Bearer realm=\"https://accounts.google.com/\", error=\"invalid_token\"","vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Tue, 08 Mar 2022 19:10:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2022-03-08T19:10:55.281Z] <<< HTTP RESPONSE BODY {"error":{"code":401,"message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}}
[2022-03-08T19:10:55.282Z] error getting database typeHTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. {"name":"FirebaseError","children":[],"context":{"body":{"error":{"code":401,"message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}},"response":{"statusCode":401,"body":{"error":{"code":401,"message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}},"headers":{"www-authenticate":"Bearer realm=\"https://accounts.google.com/\", error=\"invalid_token\"","vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Tue, 08 Mar 2022 19:10:55 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"appengine.googleapis.com","port":443,"hostname":"appengine.googleapis.com","hash":null,"search":null,"query":null,"pathname":"/v1/apps/eventos-staging-93d3a","path":"/v1/apps/eventos-staging-93d3a","href":"https://appengine.googleapis.com/v1/apps/eventos-staging-93d3a"},"method":"GET"}}},"exit":1,"message":"HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":401}
[2022-03-08T19:10:55.290Z] database_type: undefined
Error: It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/eventos-staging-93d3a/firestore to create your Cloud Firestore database. |
This seem to be a degration occurred from v10.2.0, from which some OAuth scopes are missing compared to login without |
I just had the same error, with the exact same context. I have the issue with 10.4.2. |
I also did login firebase with option |
@PorcoRosso85 until this gets fixed I guess that you will have to go down to 10.1.5. |
hello, I'm in bandwagon when it comes to this problem: [firebase init firestore not work with existing project] but somehow I manage to deal with it, here's my solution/timeline:
hope it helps~ |
We had to make an adjustment to the |
I have this issue using latest 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:
(project id redacted) |
I am also having this problem with version 11.16.0. I just made my project, initialized firestore database, and tried "firebase init"
|
I am having the same issue as well. |
I waited ~12h to see if it was just some propagation issue but not joy. |
Also experiencing this issue Recreating the project via the firebase cli didn't work unfortunately, still running into the same issue: Firestore setup/populated and Blaze billing enabled on everything |
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} |
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!! |
What exactly is this, and where? Cheers |
FYI filed a bug report above as it seems many (including myself) continue to have this issue and get directed here likely via search. #5452 Seems to be a bug because intended behavior would be that this is handled gracefully. Options include:
|
To solve the problem: |
Setting the GCP location did NOT resolve the issue for me. Using the CLI tools version 11.22.0, I have tried logging in and out both with and without the --no-localhost flag, but it still insists I haven't set up a database when I most certainly have. Also I ensured the GCP location is set (nam5 (us-central)) Anyone have any other ideas? |
Check you have the correct project selected in the cli. Can't remember the command off hand but it's obvious from the cli help |
I only have one Firebase project. I did check again just now to make sure, and to see if maybe the GCP change had finally propagated. Still no luck. I am trying to push a hotfix to a project I deployed in early 2021 and haven't really touched since then, so maybe there is something else that has changed about the configuration I need to update? Really appreciate your help! |
This is not fixed, I still get this - firebase version 11.4.2 |
Yup, same here. The problem still exists.. My Default GCP resource location is filled in.. and tried the other mentioned solutions here above.. but no luck. |
If it doesn't work when you install a specific version, you can install latest version. Also, execute the following two codes regardless of whether they are global or not and before command "firebase init" I think setting firebase console before command firebase init is important |
Setting GCP location + doing this worked, thank you. |
I think it's not possible to update the default GCP location anymore. I personally fixed it after upgrading the firebase-tools cli |
I second that. The current version is giving that there is no Firebase being used on a project that is running Firebase for the past month with GCP location set in Europe. |
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] |
Ok |
I have the same problem, I have to use |
How is this still a problem 2 years later? I am running into this now. |
solves it for me... (for a while) |
I tried all the above and this is the only thing that worked for me. |
Thanks @anhtuank7c. This is the only thing that worked for me after so many other options #4254 (comment) |
I kept having this issue, and it turns out that the only fix was to create a "(default)" name database. |
This was the only fix that worked because I couldn't modify the default GCP location. Thanks for posting this, I would have been stuck for days trying to figure this out. |
This is still an issue. Even when you create a default named database. Also cannot change the GCP location. This issue is several years old now. |
DESCRIPTION
work very well with version 10.0.1
**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
[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.
The text was updated successfully, but these errors were encountered: