-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
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 the GOOGLE_APPLICATION_CREDENTIALS environment variable.
This seems to be due to getAppEngineProjectId() returning a project id even when running outside GAE, causing getDefaultProjectId() to not call getServiceAccountProjectId().
This seems to have been introduced in #3413 and resulted in the behavior changing from google-cloud-core 1.3.0 to 1.4.0.
Documentation:
- https://github.com/GoogleCloudPlatform/google-cloud-java#specifying-a-project-id
- https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java#L321
Repro: https://github.com/danielnorberg/google-cloud-java-default-project-bug-repro
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.