Project does not exists or it does not contain an Active Cloud DataStore

Viewed 7876

I have an application on Google Cloud Platform that uses FireStore as the Database.

I am getting this error when trying to insert records on FireStore.

google.api_core.exceptions.NotFound: 404 The project "book-shop-c73ec" does not
exist or it does not contain an active Cloud Datastore database. Please visit ht
tp://console.cloud.google.com to create a project or https://console.cloud.googl
e.com/datastore/setup?project="book-shop-c73ec" to add a Cloud Datastore databas
e. Note that Cloud Datastore always has an associated App Engine app and this ap
p must not be disabled.

This is the sample code I am using.

from google.cloud import firestore

# Add a new document
db = firestore.Client()
doc_ref = db.collection(u'users').document(u'alovelace')
doc_ref.set({
    u'first': u'Ada',
    u'last': u'Lovelace',
    u'born': 1815
})

# Then query for documents
users_ref = db.collection(u'users')
docs = users_ref.get()

for doc in docs:
    print(u'{} => {}'.format(doc.id, doc.to_dict()))

My application is enabled on app engine :

enter image description here

And when I go to the DataStore Tab, I am pointed to FireStore.

enter image description here

Did I miss any step here?

Found this link, but its just suggesting to enable the app on app engine, which I already did.

3 Answers

I was having this exact error, but my problem was that app engine was disabled in the project, enabling it solved the problem and I was able to upgrade to Firestore.

It was just an error on my environment variable on windows.

I had set it to

set GCLOUD_PROJECT="project-name"

instead

set GCLOUD_PROJECT=project-name

GCLOUD_PROJECT is already deprecated in favor of GOOGLE_CLOUD_PROJECT, where btw you are expected to set the project id and not the name!

Related