From 2dd34a4e39c2bced346ef539b7f33a2535663e9a Mon Sep 17 00:00:00 2001 From: 0daryo Date: Mon, 11 Nov 2024 16:03:55 +0900 Subject: [PATCH] google: handling error on getting project id from google metadata server --- google/default.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/google/default.go b/google/default.go index df958359a..cf945ac3c 100644 --- a/google/default.go +++ b/google/default.go @@ -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 {