firebase-tools
firebase-tools copied to clipboard
Using multi-project configuration and Auth emulator
Before I submit this as a feature request, I want to see if I am correct in understanding the problem and if this is even a viable feature.
Basically, I just recently learned about the possibility of easily using multiple-projects: https://firebase.google.com/docs/projects/multiprojects. This sounded perfect for the use-case I had in mind: I have an administration system API that overviews some production data. So, the system was set up a separate Google Function of the same project as the production API. The administrative system has authentication and so does the separate production API function. Ideally, I wouldn't want to have administrative users be a part of the the same Firebase Auth storage as the production users. This is when I decided to try the multi-project setup.
I run two Auth emulators using different ports but sadly, when initializing the second app using initializeApp, the emulator proxy gives a warning Non-default "firebase-admin" instance created! This instance will *not* be mocked and will access production resources. So I don't see a way to run the system locally using both emulator instances at once...
I checked the emulator proxy code and saw that as soon as the initializeApp uses an app name (which is required for a non-default initialization), the emulator won't proxy the logic to the emulators: https://github.com/firebase/firebase-tools/blob/a90f28aacb23618fd7101960b11ab0e421c25072/src/emulator/functionsEmulatorRuntime.ts#L580
Is there a way around this? If not, is this something that can possibly be supported in the future?