[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Connect admin-sdk inside functions emulator to multiple different Firebase Projects Emulator instances (Auth,Firestore,..) #2226

Open
henkaumio opened this issue Jun 27, 2023 · 1 comment

Comments

@henkaumio
Copy link
henkaumio commented Jun 27, 2023
  • I have multiple Firebase Projects
  • One should be a central "Auth-Provider-Project" which creates custom auth tokens in Firebase Functions for multiple different Firebase Projects

Usually i can initialize multiple different admin apps like so:

const authProviderProject = admin.initializeApp(
  { credential: admin.credential.cert(authProviderProjectCred), },
  "appOne"
);

const appTwo = admin.initializeApp(
  { credential: admin.credential.cert(appTwoCred), },
  "appTwo"
);

In this way my locally run admin-sdk (inside the functions emulator) connects to the remote Firebase projects.
The problem now occurs when I also want to emulate Auth, and Firestores locally in the dev/emulator environment. I have to run another set of emulators for each project (next to the authProviderProject which owns the functions using the admin-sdk), but now i can't link my Auth Project Emulators and therefore cant initialize the admin-sdk-apps for my other Projects.
I believe this might be because my functions emulator sets this ENV_VAR:
export FIREBASE_AUTH_EMULATOR_HOST="127.0.0.1:9099"
So i guess i would need a way to point different app initializations to different emulator ports?

I have also tried to initialize the app with the 'projectId' field, but this didn't connect to the correct emulator running on a different port than stated in the FIREBASE_AUTH_EMULATOR_HOST variable.

const appTwo = admin.initializeApp(
  { credential: admin.credential.cert(appTwoCred), projectId: "firebaseProjectTwoId" },

  "appTwo"
);

like stated here

Is there a way I can connect multiple locally run emulator suites (multiple Firebase Projects) to the same locally run functions emulator?

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@henkaumio henkaumio changed the title [FR] Connect admin-sdk inside functions emulator to multiple auth emulators [FR] Connect admin-sdk inside functions emulator to multiple different Firebase Projects Emulator instances (Auth,Firestore,..) Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants