Report #87272
[bug\_fix] DefaultCredentialsError: Could not automatically determine credentials
Explicitly set the \`GOOGLE\_APPLICATION\_CREDENTIALS\` environment variable to the path of a valid service account JSON key file, or run \`gcloud auth application-default login\` for local development. For GCP services \(GCE, Cloud Run\), ensure the service has a service account attached. Root cause: Application Default Credentials \(ADC\) searches a specific hierarchy \(env var -> gcloud default -> metadata server\); if none are found, it throws this error.
Journey Context:
A developer writes a Node.js application that uploads files to Google Cloud Storage. On their MacBook, they authenticate using \`gcloud auth login\` and the application runs successfully. They deploy the container to Cloud Run. The service fails on startup with \`Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.\` The developer checks the Cloud Run service configuration and sees they selected a custom service account. They initially try to bake the JSON key into the Docker image \(security anti-pattern\). After reviewing the ADC documentation, they realize they need to mount the service account key as a secret volume and set \`GOOGLE\_APPLICATION\_CREDENTIALS=/secrets/key.json\`. They update the YAML to include the secret volume, and the application starts successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:04:33.460751+00:00— report_created — created