From 2aff760799b6601b38f8e306ba015577b6fe2d7f Mon Sep 17 00:00:00 2001 From: Michelle Shepardson Date: Mon, 16 Sep 2024 21:24:37 +0000 Subject: [PATCH] Specify auto-project detection for PubSub. In pubsub v1.32, a breaking change made it so specifying a blank project results in an error, rather than automatically detecting the project as it did before. Instead, specify the sentinel value for detecting the project automatically. See https://github.com/googleapis/google-cloud-go/releases/tag/pubsub%2Fv1.32.0. Note that an update a while back upgraded the pubsub module version from v1.22.2 to v1.33.0. --- cmd/summarizer/main.go | 2 +- cmd/tabulator/main.go | 2 +- cmd/updater/main.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/summarizer/main.go b/cmd/summarizer/main.go index 330e61dd4..c4de0a3ec 100644 --- a/cmd/summarizer/main.go +++ b/cmd/summarizer/main.go @@ -96,7 +96,7 @@ func gcsFixer(ctx context.Context, projectSub string, configPath gcs.Path, tabPr return nil, errors.New("malformed project/subscription") } projID, subID := parts[0], parts[1] - pubsubClient, err := gpubsub.NewClient(ctx, "", option.WithCredentialsFile(credPath)) + pubsubClient, err := gpubsub.NewClient(ctx, gpubsub.DetectProjectID, option.WithCredentialsFile(credPath)) if err != nil { logrus.WithError(err).Fatal("Failed to create pubsub client") } diff --git a/cmd/tabulator/main.go b/cmd/tabulator/main.go index 3dd1e44bc..65f393647 100644 --- a/cmd/tabulator/main.go +++ b/cmd/tabulator/main.go @@ -183,7 +183,7 @@ func gcsFixer(ctx context.Context, projectSub string, configPath gcs.Path, gridP return nil, errors.New("malformed project/subscription") } projID, subID := parts[0], parts[1] - pubsubClient, err := gpubsub.NewClient(ctx, "", option.WithCredentialsFile(credPath)) + pubsubClient, err := gpubsub.NewClient(ctx, gpubsub.DetectProjectID, option.WithCredentialsFile(credPath)) if err != nil { logrus.WithError(err).Fatal("Failed to create pubsub client") } diff --git a/cmd/updater/main.go b/cmd/updater/main.go index 4463c2821..1b8d600fa 100644 --- a/cmd/updater/main.go +++ b/cmd/updater/main.go @@ -215,7 +215,7 @@ func main() { mets := updater.CreateMetrics(prometheus.NewFactory()) - pubsubClient, err := gpubsub.NewClient(ctx, "", option.WithCredentialsFile(opt.creds)) + pubsubClient, err := gpubsub.NewClient(ctx, gpubsub.DetectProjectID, option.WithCredentialsFile(opt.creds)) if err != nil { logrus.WithError(err).Fatal("Failed to create pubsub client") }