firebase / firebase/firebase-admin-go
storage: WithHTTPClient is incompatible with gRPC dial options
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 274
- Avg merge
- 10h 39m
- Merged PRs (30d)
- 2
Description
I've been calling `firebase.NewApp` as follows since 8/2018:
```go
var (
app *firebase.App
err error
)
app, err = firebase.NewApp(
context.Background(),
&firebase.Config{ProjectID: Config.GCPProject()},
// these options should prevent the error: "rpc error: code = Unavailable desc = transport is closing"
// pubsub client uses these by default
// related: https://github.com/GoogleCloudPlatform/google-cloud-go/issues/479
option.WithGRPCConnectionPool(runtime.GOMAXPROCS(0)),
option.WithGRPCDialOption(grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 5 * time.Minute})),
)
```
After upgrading to firebase-admin-go v4.18.0, I started getting the following error when initializing the storage client (`app.Storage(ctx)`): **"WithHTTPClient is incompatible with gRPC dial options"**
Overriding the version of the Cloud Storage package in my `mod.go` is my current workaround:
```
replace cloud.google.com/go/storage => cloud.google.com/go/storage v1.50.0
```
I will try removing those gRPC options as I don't know if they're still needed.
Regardless, the google-cloud-go team pointed out that [`storage.NewGRPCClient` needs to be used with gRPC options](https://github.com/googleapis/google-cloud-go/issues/12886#issuecomment-3310422813). It appears that `app.Storage` merges in whatever options are passed to `firebase.NewApp`, but it doesn't look like anything is being done to determine whether the Cloud Storage gRPC client should be used instead of `storage.NewClient`.
Contributor guide
Assessment
This issue has not been assessed yet.