Firebase-tools: config credentials failing in emulator

Created on 4 Sep 2017  路  5Comments  路  Source: firebase/firebase-tools

Version info


3.9.2

Steps to reproduce

  • Setup a firebase functions project and initialize admin through firebase config.
  • Run local emulator (through serve)
  • Try use any command in auth, such as getUserByEmail (database works perfectly however)

admin.initializeApp(functions.config().firebase);
admin.auth().getUserByEmail("[email protected]")

Expected behavior


Works in emulator.
Works when deployed.

Actual behavior

Fails in emulator (Error: No Firebase project was found for the provided credential.)
Works when deployed.


https://gist.github.com/kiwipxl/791af036794a24ab8cdceffc8a626836

Most helpful comment

Thanks for the report! This is a bug in the way that the local emulator deals with default credentials. This will unfortunately take some time to fix, in the meanwhile, you can work around this by initializing firebase-admin with a service account (https://firebase.google.com/docs/admin/setup#initialize_the_sdk)

All 5 comments

Thanks for the report! This is a bug in the way that the local emulator deals with default credentials. This will unfortunately take some time to fix, in the meanwhile, you can work around this by initializing firebase-admin with a service account (https://firebase.google.com/docs/admin/setup#initialize_the_sdk)

This workaround to the admin.initializeApp(functions.config().firebase); issue is helpful - thankyou.

Is there also a bug with how the emulator deals with config?

Currently, running
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"

As per these instructions works as expected once deployed and in production logs. However, someservice is non-existent in the config, when serving locally.

We do not yet support emulation of config values, see https://firebase.google.com/docs/functions/local-emulator#install_and_configure_the_cloud_functions_shell for the workaround

Closing for inactivity.

Was this page helpful?
0 / 5 - 0 ratings