firebase / firebase-admin-go

Firebase Admin Go SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: Can't connect to Auth Emulator with Go despite setting env variable

kyleshepherd opened this issue · comments

  • Operating System version: MacOS 13.1
  • Firebase SDK version: 4.10.0
  • Firebase Product: auth + storage

I am trying to use the Firebase emulators in an API I'm building with Go. I've got the Firestore emulator working fine, but the Auth one is being ignored and instead my actual Firebase project's Authentication is being used.

// .envrc

export GOOGLE_APPLICATION_CREDENTIALS=./record-dev-sa.json
export FIRESTORE_EMULATOR_HOST=localhost:8080
export FIREBASE_AUTH_EMULATOR_HOST=localhost:9099
export GCLOUD_PROJECT=record-dev-8198f

// serve.go
app, err := firebase.NewApp(ctx, nil)
if err != nil {
  return err
}

client, err := app.Auth(ctx)
if err != nil {
  return nil, err
}

I've tried setting the GCLOUD_PROJECT env variable as well but it isn't changing the results. I expected this to behave the same as the Firestore Emulator, where it automatically picks up the env variable without any other changes required