Skip to content

Commit

Permalink
Specify auto-project detection for PubSub.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michelle192837 committed Sep 16, 2024
1 parent 1192f6a commit 2aff760
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/summarizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/tabulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 2aff760

Please sign in to comment.