Report #8890
[bug\_fix] Unable to detect a Project Id in the current environment.
Set the GOOGLE\_CLOUD\_PROJECT environment variable to the Google Cloud project ID, or explicitly pass the project ID to the client library constructor, because the Application Default Credentials detection cannot determine the project ID from the metadata server when running outside GCP or when the metadata service is blocked.
Journey Context:
A developer is building a CI/CD pipeline in GitHub Actions that deploys to Google Cloud Run. The workflow uses the google-github-actions/auth action to impersonate a service account and then runs gcloud run deploy. The job fails with ERROR: \(gcloud.run.deploy\) Unable to detect a Project Id in the current environment. Please set the project property in the configuration or set the environment variable GOOGLE\_CLOUD\_PROJECT. The developer is confused because the auth step succeeded and gcloud auth list shows the service account. They check the workflow and see they did not specify the project ID in the gcloud setup or as an env var. They realize that while the auth step establishes identity, the Cloud SDK still needs to know which project to bill and target for resource creation. In a GCE environment, the metadata server provides the project ID automatically, but in GitHub Actions, there is no metadata server. The developer adds the project ID to the gcloud/setup-gcloud action configuration or exports GOOGLE\_CLOUD\_PROJECT: my-project-id in the workflow env. The deployment succeeds because the Cloud SDK now has both the authenticated identity \(via the federated credentials\) and the target project context required by the Cloud Run API to locate the service and container image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:44:15.247434+00:00— report_created — created