bug: from_service_account_json fails without GOOGLE_APPLICATION_CREDENTIALS env var set
See original GitHub issuepypinfo-96fad88c6384.json
{
"type": "service_account",
"project_id": "pypinfo-167519",
"private_key_id": "96fad88c63844bd52d6aa14806a07ee04f68f756",
"private_key": "-----BEGIN PRIVATE KEY-----...redacted...-----END PRIVATE KEY-----\n",
"client_email": "moa-379@pypinfo-167519.iam.gserviceaccount.com",
"client_id": "109462256829445067003",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/moa-379%40pypinfo-167519.iam.gserviceaccount.com"
}
Ofek@Ofek-PC ~ $ from google.cloud.bigquery import Client
Ofek@Ofek-PC ~ $ client = Client.from_service_account_json(r'C:\Users\Ofek\AppData\Local\creds\pypinfo-96fad88c6384.json')
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 14826, in default
run_compiled_code(code, self.ctx, None, 'single')
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 2085, in run_compiled_code
func(code, glb, loc)
File "<xonsh-code>", line 1, in <module>
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 71, in from_service_account_json
return cls(*args, **kwargs)
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\bigquery\client.py", line 83, in __init__
project=project, credentials=credentials, _http=_http)
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 211, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 167, in __init__
project = self._determine_default(project)
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 180, in _determine_default
return _determine_default_project(project)
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\_helpers.py", line 181, in _determine_default_project
_, project = google.auth.default()
File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\auth\_default.py", line 282, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or
explicitly create credential and re-run the application. For more
information, please see
https://developers.google.com/accounts/docs/application-default-credentials.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Setting up environment variables in node, specifically ...
I want to set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the json file in the same directory (sibling to package.json and ...
Read more >Problems with Environment Variables
Environment variable is not set. If the error message states that the environment variable is not set, IT MEANS PRECISELY THAT ! The...
Read more >Error messages | Document AI
ERROR : (gcloud.auth.application-default.print-access-token) File /path/to/key.json (pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not ...
Read more >Troubleshoot issues when passing environment variables ...
You can pass an environment variable inside your Amazon ECS task in ... to download env files: file download command: non empty error...
Read more >IBM MQ - Environment variables
On Windows Systems, use: Set [environment variable]=value . ... TRUE), this instructs IBM MQ not to generate FFSTs when reporting AMQ9207E error messages...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ofek Yeah unfortunately that’s the best you can do for now. I’ll try to send a legit fix for #1883 tomorrow.
@dhermes Oh, I see. Thanks! I suppose I’ll just parse the file for project id myself to pass to
from_service_account_json
.