Skip to content
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 CLI Can't Find Cloud Firestore Instance because Firebase Doesn't Set GCP Default Resource Location #5452

Closed
sambshapiro opened this issue Jan 22, 2023 · 1 comment

Comments

@sambshapiro
Copy link

sambshapiro commented Jan 22, 2023

Environment info

firebase-tools: 11.21.0

Platform: macOS

Test case

Initialize firestore in firebase CLI for a new project by runnning firebase init firestore.

Steps to reproduce

  1. Create a new Firebase project in the web console.
  2. Create a fresh Firestore database.
  3. Install/update firebase tools CLI on your Mac.
  4. Log in to Firebase via the firebase tools CLI.
  5. Run firebase init firestore --debug and when prompted, select the Firebase project you created in step 1.

Expected behavior

Successful API request of:
[2023-01-22T19:52:19.975Z] <<< [apiv2][body] GET https://appengine.googleapis.com/v1/apps/[app-name]

Below, you can see the cause of the issue is that the default GCP resource location is not set. It would seem that the expected behavior would be for the console to force/prompt the user to choose a default GCP resource location with initial setup.

Actual behavior

[2023-01-22T19:48:57.505Z] <<< [apiv2][body] GET https://appengine.googleapis.com/v1/apps/[app-name] {"error":{"code":404,"message":"App does not exist.","status":"NOT_FOUND"}}
[2023-01-22T19:48:57.505Z] 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}
[2023-01-22T19:48:57.506Z] 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/[app-name]/firestore to create your Cloud Firestore database.

Temporary Solution

A solution has already been found in an off-topic (closed) issue here: #4254

The solution (#4254 (comment)):

  1. Go to firebase web console.
  2. Click project settings (gear icon on the left).
  3. Select your project.
  4. Set the default GCP resource location.

However, I'm filing the bug report because users will continue to have this issue and experience confusion as the CLI gives a non-descriptive error, and it would seem that the expected behavior would be for the console to force/prompt the user to choose a default GCP resource location with initial setup.

Permanent Solution

Options include:

  • Console prompting user to set the default GCP location when setting up the Firestore instance initially
  • CLI giving more descriptive error, that GCP default resource location needs to be set in the console
  • CLI automatically setting the default GCP resource location
@sambshapiro sambshapiro changed the title Firebase CLI Can't Find Cloud Firestore Instance Firebase CLI Can't Find Cloud Firestore Instance because Firebase Doesn't Set GCP Default Resource Location Jan 22, 2023
@joehan
Copy link
Contributor

joehan commented Jan 26, 2023

Thanks for reporting this. init firestore was checking for a default resource location, because firestore used to require one. Now that it doesn't (and now that setting up a Firestore DB doesn't set DRL), this check was frequently failing for new projects.

Fixed by #5261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants