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

[Spanner] credentials object not passed into InstanceAdminAPI #3070

Closed
supertom opened this issue Feb 25, 2017 · 2 comments
Closed

[Spanner] credentials object not passed into InstanceAdminAPI #3070

supertom opened this issue Feb 25, 2017 · 2 comments
Assignees
Labels
api: spanner Issues related to the Spanner API. auth release blocking Required feature/issue must be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@supertom
Copy link
Contributor

supertom commented Feb 25, 2017

Hi Folks,

I don't see that the credentials I pass into the Spanner Client are being used for the InstanceAdminClient or DatabaseAdminClient instantiations. I'm chasing a downstream bug and will fill in details soon, but from what I see, defaultcredentials are assumed to be used when using those APIs, whereas it should use the provided credentials object.

  1. OS type and version
    CentOS
  2. Python version and virtual environment information python --version
    Python 2.7.9
  3. google-cloud-python version pip show google-cloud, pip show google-<service> or pip freeze
gapic-google-cloud-spanner-admin-database-v1==0.15.0
gapic-google-cloud-spanner-admin-instance-v1==0.15.0
gapic-google-cloud-spanner-v1==0.15.0
google-auth==0.8.0
google-auth-httplib2==0.0.2
google-cloud-core==0.23.1
google-cloud-spanner==0.23.1
google-compute-engine==2.3.2
google-gax==0.15.6
googleapis-common-protos==1.5.2
grpc-google-iam-v1==0.11.1
grpcio==1.1.3
  1. Stacktrace if available
  2. Steps to reproduce
  • Create credentials with a service account. Make sure default credentials will fail.
  • Try to interact with an instance.
  1. Code example
import google.auth.credentials
from google.cloud import spanner
from google.oauth2 import service_account
SPANNER_ADMIN_SCOPE = 'https://www.googleapis.com/auth/spanner.admin'
JSON_KEY='/home/me/keys/mykey.json'

credentials = service_account.Credentials.from_service_account_file(
                JSON_KEY)
scopes = [ SPANNER_ADMIN_SCOPE ]
credentials = credentials.with_scopes(scopes)
# credentials = google.auth.credentials.with_scopes_if_required(credentials, scopes)
sc = spanner.Client(project='my-project, credentials=credentials)

i = sc.instance('my-instance', configuration_name='regionally-us-central1')
i.exists()

I checked these sites before filing:

@daspecster daspecster added the api: spanner Issues related to the Spanner API. label Feb 27, 2017
@danoscarmike danoscarmike added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. release blocking Required feature/issue must be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 28, 2017
@lukesneeringer
Copy link
Contributor

Thanks for raising this issue. It looks like a bug; we will look into it soon.

@tseaver
Copy link
Contributor

tseaver commented Apr 25, 2017

On this now.

@theacodes theacodes removed the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Apr 25, 2017
@theacodes theacodes added the auth label May 5, 2017
richkadel pushed a commit to richkadel/google-cloud-python that referenced this issue May 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. auth release blocking Required feature/issue must be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

6 participants