Skip to content

storage: WithHTTPClient is incompatible with gRPC dial options #717

@bgetsug

Description

@bgetsug

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions