Report #77324
[bug\_fix] Google Cloud DefaultCredentialsError outside GCP environment
Set the \`GOOGLE\_APPLICATION\_CREDENTIALS\` environment variable to the absolute path of the service account JSON key file, or run \`gcloud auth application-default login\` for local development. Root cause: Application Default Credentials \(ADC\) follows a search order: env var, GAE/App Engine, Cloud Functions metadata, GKE metadata, Compute Metadata. Outside GCP, only the env var or gcloud login files exist; if neither is present, the client library cannot determine identity.
Journey Context:
A data scientist writes a Python script using \`pandas-gbq\` to query BigQuery. It works perfectly in their Vertex AI Workbench notebook. They download the \`.ipynb\` to their local MacBook, install the same packages, and run it. Immediately, it fails with \`DefaultCredentialsError: Could not automatically determine credentials\`. The scientist checks \`gcloud config list\` and sees they are logged in, but the error persists. Searching StackOverflow, they learn that \`gcloud\` login and Application Default Credentials are separate. They run \`gcloud auth application-default login\`, complete the browser OAuth flow, and the script works. Later, for production deployment on a VM, they learn to use \`GOOGLE\_APPLICATION\_CREDENTIALS\` pointing to a service account key.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:23:17.958007+00:00— report_created — created