Skip to content

AutoML: pass credentials from Table client to underlying client. #9490

Closed

Description

@shunghsiyu

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.

Activity

  1. added a commit that references this issue on Oct 17, 2019
    a6a2d05
  2. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: automlIssues related to the AutoML API.
    on Oct 17, 2019
  3. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Oct 22, 2019
  4. changed the title [-]AutoML: Table client does not make use of credentials passed[/-] [+]AutoML: pass credentials from Table client to underlying client.[/+] on Oct 22, 2019
  5. added a commit that references this issue on Oct 28, 2019
    9e5ca9a
  6. added a commit that references this issue on Oct 21, 2023
    4648b40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: automlIssues related to the AutoML API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions