I've been calling firebase.NewApp as follows since 8/2018:
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. 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.
I've been calling
firebase.NewAppas follows since 8/2018: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.gois my current workaround: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.NewGRPCClientneeds to be used with gRPC options. It appears thatapp.Storagemerges in whatever options are passed tofirebase.NewApp, but it doesn't look like anything is being done to determine whether the Cloud Storage gRPC client should be used instead ofstorage.NewClient.