firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.12k stars 239 forks source link

Error building - undefined: storage.CommonRequestParams #503

Closed daveteu closed 1 year ago

daveteu commented 2 years ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

New project with the following codes

package firebase

import (
    "context"
    "log"

    firebase "firebase.google.com/go/v4"
    "google.golang.org/api/option"
)

var Firebase *firebase.App

func Init() {

    opt := option.WithCredentialsFile("./......json")
    config := &firebase.Config{ProjectID: "firebase-adminsdkf@.......iam.gserviceaccount.com"}
    app, err := firebase.NewApp(context.Background(), config, opt)
    if err != nil {
        log.Fatalf("error initializing app: %v\n", err)
    }

    Firebase = app
}

Error encountered

# cloud.google.com/go/storage
../../../go/pkg/mod/cloud.google.com/go/storage@v1.21.0/writer.go:451:24: undefined: storage.CommonRequestParams
../../../go/pkg/mod/cloud.google.com/go/storage@v1.21.0/writer.go:453:23: undefined: storage.CommonRequestParams
../../../go/pkg/mod/cloud.google.com/go/storage@v1.21.0/writer.go:461:3: unknown field 'CommonRequestParams' in struct literal of type "google.golang.org/genproto/googleapis/storage/v2".StartResumableWriteRequest

PS: I am just using firebase admin for authentication, I do not have any codes that is using storage.

daveteu commented 2 years ago

This issue is related to https://github.com/googleapis/google-cloud-go/issues/6055

I'm not sure why firebase admin is bundled with 1.21.0 and no one is reporting the same error as me, but it can be resolved should we upgrade cloud.google.com/go ourself to 1.22.1 which is the version that fixed the bug.

Solution

go get cloud.google.com/go/storage@v1.22.1
lahirumaramba commented 1 year ago

Thank you for reporting this issue. As the current version now points to cloud.google.com/go/storage v1.26.0 I am closing this issue. We can reopen later if needed.