Translate SDK - Using External Account Credentials (WIF) Results in Permission Error #13855
Open
1 task done
Content-Length: 274587 | pFad | http://github.com/googleapis/google-cloud-python/issues/13855
F9Fetched URL: http://github.com/googleapis/google-cloud-python/issues/13855
Alternative Proxies:
Determine this is the right repository
Summary of the issue
Context
I am deploying building a CICD pipeline in Gitlab that authenticates to Google Cloud using Workload Identity Federation. The workload identity pool and the service account it impersonates are in a separate project from the main application. Some of the pipeline tests require usage of the
google-cloud-translate
client using quota in the application project. Because the Translation API is client-based, I have to specify the quota project ID of the application project to authenticate.The error indicates that the Service Usage Consumer role is missing on the application project, but I've added this role to both the WIF principal as well as the service account it's impersonating. I've also tested directly calling the Translation API with curl on the same pipeline step with no issues, so it seems to be a client-related issue.
Expected Behavior:
Providing the quota project ID to translation client methods (e.g.
translate.TranslationServiceAsyncClient.translate_text
), successfully returns a translated response.Actual Behavior:
The following exception trace with application code and project information redacted.
API client name and version
google-cloud-translate==3.15.5
Reproduction steps: code
file: main.py
Reproduction steps: supporting files
file: .gitlab-ci.yaml
Reproduction steps: actual results
CURL-based translation
file: stdout
Python test file output
file: stdout
Reproduction steps: expected results
CURL-based translation
file: stdout
Python test file output
file: stdout
OS & version + platform
Debian Bookworm (via google/cloud-sdk:latest image) on Gitlab Runner 17.10.1
Python environment
Python 3.12.10
Python dependencies
google-cloud-translate==3.15.5
google-auth==2.38.0
Additional context
No response
The text was updated successfully, but these errors were encountered: