Unable to connect to Firestore Emulator with preferRest: true #1811
Labels
api: firestore
Issues related to the googleapis/nodejs-firestore API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
When REST fallback is enabled by setting
preferRest: true
, the fallback client obtains an authenticatedgoogle-auth-library
client to communicate with the Firestore BE services.If the emulator mode is enabled by setting
FIRESTORE_EMULATOR_HOST
env var, the rest client will look for application default credentials in the environment to initialize credentials to obtain an authenticatedgoogle-auth-library
client. This step fails if there are no credentials set in the environment. Firestore Client should not use service account credentials to connect to the emulator even if the real service credentials are available, instead we should explicitly set emulator credentials on emulator mode.We already set emulator credentials on gRPC mode by setting custom headers at:
nodejs-firestore/dev/src/index.ts
Line 1453 in 653a8e9
Steps to reproduce:
export FIRESTORE_EMULATOR_HOST="localhost:8080"
unset GOOGLE_APPLICATION_CREDENTIALS
gcloud auth application-default revoke
Expected:
Actual:
Related to: firebase/firebase-admin-node#2016 🦕
The text was updated successfully, but these errors were encountered: