Skip to content

Commit

Permalink
Remove enforcement of BUFBUILD_AUTH_TOKEN
Browse files Browse the repository at this point in the history
It appears a Buf token is not mandatory anymore to fetch descriptors set from Buf API anymore. There is probably rate limits but outside of this, seems that it's possible to fetch it without a token.

If we see that we start to have some rate limit errors, we shall re-introduced a specific handling to ask use to provide a `BUFBUILD_AUTH_TOKEN`.
  • Loading branch information
maoueh committed Feb 5, 2025
1 parent 475568f commit b4c0d83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions docs/release-notes/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

### Server

* Limit parallel execution of a stage's layer.

Previously, the engine was executing modules in a stage's layer all in parallel. We now change that behavior, development mode will from now on execute every sequentially and when in production mode will limit parallelism to 2 (hard-coded) for now.

The auth plugin can control that value dynamically by providing a trusted header `X-Sf-Substreams-Stage-Layer-Parallel-Executor-Max-Count`.

### CLI

* Removed enforcement of `BUFBUILD_AUTH_TOKEN` environment variable when using descriptor sets. It appears there is now a public free tier to query those which should work in most cases.

## v1.12.4

### Server
Expand Down
11 changes: 5 additions & 6 deletions manifest/protobuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ func loadDescriptorSets(pkg *pbsubstreams.Package, manif *Manifest) ([]*desc.Fil
continue
}

authToken := os.Getenv("BUFBUILD_AUTH_TOKEN")
if authToken == "" {
return nil, fmt.Errorf("missing BUFBUILD_AUTH_TOKEN; go into your account at https://buf.build/settings/user to create an API key")
}

client := reflectv1beta1connect.NewFileDescriptorSetServiceClient(
http.DefaultClient,
"https://buf.build",
Expand All @@ -146,7 +141,11 @@ func loadDescriptorSets(pkg *pbsubstreams.Package, manif *Manifest) ([]*desc.Fil
Version: descriptor.Version,
})

request.Header().Set("Authorization", "Bearer "+authToken)
authToken := os.Getenv("BUFBUILD_AUTH_TOKEN")
if authToken != "" {
request.Header().Set("Authorization", "Bearer "+authToken)
}

fileDescriptorSet, err := client.GetFileDescriptorSet(context.Background(), request)
if err != nil {
return nil, fmt.Errorf("getting file descriptor set for %s: %w", descriptor.Module, err)
Expand Down

0 comments on commit b4c0d83

Please sign in to comment.