-
Notifications
You must be signed in to change notification settings - Fork 422
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Using a credentials file when building a client for the prediction API fails. See the code sample below. From looking at the code, when initialising the PredictionServiceGrpcTransport class, the parent constructor in PredictionServiceTransport is called. The base constructor creates the credentials from the file (base.py, line 102). These credentials are then passed into the create_channel function (grpc.py, line 162) along with the credentials file, which eventually leads to the DuplicateCredentialArgs error.
Environment details
- OS type and version:
Linux xxx 5.16.1-arch1-1 #1 SMP PREEMPT Sun, 16 Jan 2022 11:39:23 +0000 x86_64 GNU/Linux - Python version:
Python 3.10.1 - pip version:
pip 20.3.4 google-cloud-aiplatformversion:Version: 1.9.0
Code example
from google.cloud import aiplatform
from google.api_core.client_options import ClientOptions
def main():
api_endpoint = "us-central1-aiplatform.googleapis.com"
# The AI Platform services require regional API endpoints.
client_options = ClientOptions(api_endpoint=api_endpoint, credentials_file='google_key.json')
# Initialize client that will be used to create and send requests.
client = aiplatform.gapic.PredictionServiceClient(client_options=client_options)
if __name__ == "__main__":
main()Stack trace
Traceback (most recent call last):
File "./credentials_bug.py", line 19, in <module>
main()
File "./credentials_bug.py", line 15, in main
client = aiplatform.gapic.PredictionServiceClient(client_options=client_options)
File "./venv/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/prediction_service/client.py", line 371, in __init__
self._transport = Transport(
File "./venv/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py", line 160, in __init__
self._grpc_channel = type(self).create_channel(
File "./venv/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py", line 212, in create_channel
return grpc_helpers.create_channel(
File "./venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 302, in create_channel
composite_credentials = _create_composite_credentials(
File "./venv/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 223, in _create_composite_credentials
raise exceptions.DuplicateCredentialArgs(
google.api_core.exceptions.DuplicateCredentialArgs: 'credentials' and 'credentials_file' are mutually exclusive.
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.