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- google-cloud-firestore error #179

Closed
constantinos07 opened this issue Jul 7, 2018 · 5 comments
Closed

Firebase- google-cloud-firestore error #179

constantinos07 opened this issue Jul 7, 2018 · 5 comments

Comments

@constantinos07
Copy link

constantinos07 commented Jul 7, 2018

Description of the problem

I am trying to run a Firestore request on the Google App Engine. When I execute the sample code below on an IDE, it runs without any errors. But when i execute it on the app engine: curl localhost:8080 I get the error message that is shown below.

Description of the environment

pip version: 10.0.1
python:2.7.12

My requirements.txt file contains:
Flask==0.10
requests==2.18.4
requests-toolbelt==0.8.0
google-api-python-client
google-auth >= 1.3.0
google-cloud-firestore >= 0.27.0
google-cloud-storage >= 1.2.0

Log error:

ERROR 2018-07-07 13:01:57,240 wsgi.py:263]
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHa
ndler
handler, path, err = LoadObject(self._handler)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObje
ct
obj = import(path[0])
File "/home/ic/project/main.py", line 16, in
from firebase_admin import credentials,firestore
File "/home/ic/project/lib/firebase_admin/firestore.py", line 28, in
raise ImportError('Failed to import the Cloud Firestore library for Python. Make sure '
ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.

###sample code
import requests
import requests_toolbelt.adapters.appengine
import firebase_admin
from firebase_admin import credentials,firestore

requests_toolbelt.adapters.appengine.monkeypatch()
credentials = credentials.Certificate("key.json")
default_app = firebase_admin.initialize_app(credentials)

db= firestore.client()
doc_ref = db.collection(u'docum1').document(u'name')
doc_ref.set({u'name': u'name', })

@google-oss-bot
Copy link

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

@google-oss-bot
Copy link

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

@hiranya911
Copy link
Contributor

If you're using the App Engine Flexible environment, one of the workaround mentioned in googleapis/google-cloud-python#5023 should work for you. I have noticed that simply reinstalling google-cloud-firestore directly, also fixes the issue most of the time.

If you're using the App Engine Standard environment, Firestore Python client is not supported there.

@joelfernandes19
Copy link

Will there be support added for App Engine Standard environment?

@hiranya911
Copy link
Contributor

@joelfernandes19 that's a question for the Firestore team. Check with https://github.com/GoogleCloudPlatform/google-cloud-python

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

No branches or pull requests

4 participants