Open mattrltrent opened 1 year ago
I found a few problems with this issue:
The "steps to reproduce" example imports the v1
major version of the module, which did not have an AppCheck
method. The v4
major version ("firebase.google.com/go/v4"
) used by the example in the documentation does (docs).
The example from the documentation builds without errors for me. In an empty directory:
$ cat > main.go
package main
import (
"context"
"log"
"net/http"
firebaseAdmin "firebase.google.com/go/v4"
"firebase.google.com/go/v4/appcheck"
)
// ...
// rest of the code from https://firebase.google.com/docs/app-check/custom-resource-backend#go
// ...
$ go mod init example.com/test
go: creating new go.mod: module example.com/test
go: to add module requirements and sums:
$ go mod tidy
go: finding module for package firebase.google.com/go/v4/appcheck
go: finding module for package firebase.google.com/go/v4
go: found firebase.google.com/go/v4 in firebase.google.com/go/v4 v4.12.0
go: found firebase.google.com/go/v4/appcheck in firebase.google.com/go/v4 v4.12.0
$ go build .
// no errors
Describe your environment
golang:1.20-alpine
.Describe the problem
Original Stack Overflow source here.
First, I believe the Firebase documentation for how to use AppCheck with the Golang SDK is wrong here.
It says you need to create a new
appcheck.Client
directly via method off of yourfirebase.App
, but this method doesn't exist (anymore?):So, instead, I've referred to Firebase's
appcheck
package here which says you now need to create a new instance via this method instead:This, in theory, should work. However, note the use of an
internal
package.We can try using
NewClient(...)
, and will be able to provide its first arg ofcontext.Context
, but won't be able to provide a value for its second arg of type*internal.AppCheckConfig
because it's internal.Steps to reproduce: