Skip to content

Commit

Permalink
Handling error on getting project id from google metadata server
Browse files Browse the repository at this point in the history
  • Loading branch information
0daryo committed Nov 11, 2024
1 parent 22134a4 commit 679e492
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsPar
// Third, if we're on Google Compute Engine, an App Engine standard second generation runtime,
// or App Engine flexible, use the metadata server.
if metadata.OnGCE() {
id, _ := metadata.ProjectID()
id, err := metadata.ProjectID()
if err != nil {
return nil, fmt.Errorf("google: error getting project ID from metadata server: %v", err)
}
universeDomainProvider := func() (string, error) {
universeDomain, err := metadata.Get("universe/universe_domain")
if err != nil {
Expand Down

0 comments on commit 679e492

Please sign in to comment.