ServiceOptions.getDefaultProjectId incorrectly defaults to GCE metadata before service account #3533
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
When running on a GCE host,
ServiceOptions.getDefaultProjectId()
incorrectly returns the project id from the GCE metadata server instead of defaulting to the project ID specified in the JSON credentials file pointed by theGOOGLE_APPLICATION_CREDENTIALS
environment variable.This seems to be due to
getAppEngineProjectId()
returning a project id even when running outside GAE, causinggetDefaultProjectId()
to not callgetServiceAccountProjectId()
.This seems to have been introduced in #3413 and resulted in the behavior changing from
google-cloud-core
1.3.0
to1.4.0
.Documentation:
Repro: https://github.com/danielnorberg/google-cloud-java-default-project-bug-repro
The text was updated successfully, but these errors were encountered: