Report #75313
[bug\_fix] GCP Application Default Credentials \(ADC\) not found - DefaultCredentialsError
Run \`gcloud auth application-default login\` to populate \`~/.config/gcloud/application\_default\_credentials.json\` for local development. For production or CI, set the environment variable \`GOOGLE\_APPLICATION\_CREDENTIALS\` to the absolute path of the service account key JSON file, or attach the service account directly to the compute resource \(GCE/Cloud Run\) so the metadata server provides credentials automatically.
Journey Context:
Developer clones a Python repo using \`google-cloud-storage\`. Running locally raises \`google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials\`. Developer checks README which says "ensure ADC is set". Developer tries exporting \`GOOGLE\_APPLICATION\_CREDENTIALS\` but points to a file that doesn't exist. They then run \`gcloud auth login\` \(which sets OAuth for gcloud CLI but NOT for ADC\). Confused, they search and find \`gcloud auth application-default login\` is the specific command for ADC. After running it, a browser auth flow completes, the JSON file is created, and the script works. Later, deploying to GKE, they realize they should use Workload Identity instead of downloading keys, attaching the KSA to GSA.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:00:30.114302+00:00— report_created — created