Report #52503
[bug\_fix] GCP Application Default Credentials Not Found
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' to generate user credentials in the well-known location \(~/.config/gcloud/application\_default\_credentials.json on Linux/macOS\). Root cause: The ADC strategy searches credentials in a strict order \(env var, well-known path from gcloud, GCE metadata server\), and terminates with an error if none yield valid credentials.
Journey Context:
Developer clones a Python repository using google-cloud-storage and attempts to run it on their local macOS workstation. Upon execution, the script immediately crashes with 'google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials'. They check the README and see no setup instructions for authentication. They search the error and find GCP documentation explaining ADC. They create a service account in the Google Cloud Console and download the JSON key file to their Downloads folder. They initially try modifying the code to load the key file directly using service\_account.Credentials.from\_service\_account\_file\(\), which works but feels brittle for shared code. They discover the GOOGLE\_APPLICATION\_CREDENTIALS environment variable approach, export it in their shell profile pointing to the downloaded key, and the application works consistently without code changes. Later, they learn about 'gcloud auth application-default login' for development scenarios where they want to use their user credentials instead of service account keys, avoiding the need to manage key files entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:37:15.125583+00:00— report_created — created