-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: automlIssues related to the AutoML API.Issues related to the AutoML API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Problem
It seems that TablesClient doesn't correctly pass the credentials down to underlying clients.
Since I have neither a default credential nor GOOGLE_APPLICATION_CREDENTIALS set on my machine, I end up getting DefaultCredentialsError.
Environment details
os: macOS 10.14.2
python version: 3.7
google-cloud-automl==0.7.0
Code example
from google.cloud import automl_v1beta1
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file('sa.json')
client = automl_v1beta1.TablesClient(
credentials=credentials,
project=credentials.project_id,
region='us-central1',
)Stacktrace
/Users/account/project/.venv/bin/python /Users/account/project/prediction_starter/main.py
Traceback (most recent call last):
File "/Users/account/project/prediction_starter/main.py", line 9, in <module>
region='us-central1',
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/cloud/automl_v1beta1/tables/tables_client.py", line 110, in __init__
client_info=client_info_, **kwargs
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/cloud/automl_v1beta1/gapic/auto_ml_client.py", line 265, in __init__
address=api_endpoint, channel=channel, credentials=credentials
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py", line 67, in __init__
"grpc.max_receive_message_length": -1,
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py", line 104, in create_channel
address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 177, in create_channel
credentials, _ = google.auth.default(scopes=scopes)
File "/Users/account/project/.venv/lib/python3.7/site-packages/google/auth/_default.py", line 317, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
Expected Behavior
Successfully instantiate a TablesClient instance.
Metadata
Metadata
Assignees
Labels
api: automlIssues related to the AutoML API.Issues related to the AutoML API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.