-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.
Description
Cannot create a session when running in compute engine
An error occurs when session.create() is called from a compute engine vm. The Compute Engine VM is running in the same Google Cloud Project as the Spanner instance.
1. OS type and version
Debian GNU/Linux 9.1 (compute engine vm)
2. Python version
Python 2.7.13
3. google-cloud-python version
google-auth==1.0.2
google-auth-httplib2==0.0.2
google-cloud-bigquery==0.27.0
google-cloud-core==0.27.1
google-cloud-spanner==0.27.0
google-cloud-storage==1.4.0
google-compute-engine==2.6.0
4. Stacktrace
File "/home/mkmg/integration_test.py", line 123, in _GetProgressObjForJobRun
session.create()
File "/home/mkmg/venv/local/lib/python2.7/site-packages/google/cloud/spanner/session.py", line 98, in create
api = self._database.spanner_api
File "/home/mkmg/venv/local/lib/python2.7/site-packages/google/cloud/spanner/database.py", line 165, in spanner_api
credentials = credentials.with_scopes((SPANNER_DATA_SCOPE,))
File "/home/mkmg/venv/local/lib/python2.7/site-packages/google/auth/compute_engine/credentials.py", line 120, in with_scopes
'Compute Engine credentials can not set scopes. Scopes must be '
NotImplementedError: Compute Engine credentials can not set scopes. Scopes must be set when the Compute Engine instance is created.
5. Steps to reproduce/6. Code example
Create a Spanner instance and database in a Google Cloud Project. In the same project, create a Compute Engine VM and allow full access to all cloud APIs during creation. In the vm, run the following lines: (store the proper values in instance_name and database_name)
client = spanner.Client()
instance = client.instance(instance_name)
database = instance.database(database_name)
session = database.session()
session.create()mnbbrown
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.