Skip to content

Service account throws 503 Backend Error when executing gcloud.datastore.Query() #869

@charlesbclifford

Description

@charlesbclifford

See below the python script which throws the 50 error. The credentials being used are those of a GCP service account.

$ python
Python 2.7.8 (default, Apr 15 2015, 09:26:43) 
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gcloud import datastore
>>> datastore.set_default_dataset_id('tmp')
>>> datastore_conn = datastore.get_connection()
>>> datastore.set_default_connection(datastore_conn)
>>> q=datastore.Query('foo')
>>> print list(q.fetch())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gcloud/datastore/query.py", line 421, in __iter__
    self.next_page()
  File "/usr/lib/python2.7/site-packages/gcloud/datastore/query.py", line 388, in next_page
    transaction_id=transaction and transaction.id,
  File "/usr/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 257, in run_query
    datastore_pb.RunQueryResponse)
  File "/usr/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 108, in _rpc
    data=request_pb.SerializeToString())
  File "/usr/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 85, in _request
    raise make_exception(headers, content, use_json=False)
gcloud.exceptions.ServiceUnavailable: 503 Backend Error

These .bashrc environment variables have been set, and last is set to use the service account:

CLOUDSDK_CONFIG
CLOUDSDK_PYTHON
GOOGLE_APPLICATION_CREDENTIALS

And, $ gcloud auth activate-service-account has been run, to make the service account the 'active' credentials.

The Cloud Datastore API is enabled on the GCP project.

Also, 'gcloud config set project' has been run.

Any suggestions on how to correct this (credentials configuration) mistake are appreciated.

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions