3.9.2
admin.initializeApp(functions.config().firebase);
admin.auth().getUserByEmail("[email protected]")
Works in emulator.
Works when deployed.
Fails in emulator (Error: No Firebase project was found for the provided credential.)
Works when deployed.
https://gist.github.com/kiwipxl/791af036794a24ab8cdceffc8a626836
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.
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)