I am new to firebase cloud messaging and i am practicing it on node js and i found that we can initialize more than one app on same project . I want to know up to how many app can we initialize in one project
2
-
What have you tried so far? Can you share your existing code where you initialise one default Admin instance?Dharmaraj– Dharmaraj2022-09-08 08:57:55 +00:00Commented Sep 8, 2022 at 8:57
-
Actually i do it by providing name to each admin instance when i call admin.initialize app and i wanna know how many app can i initialize by giving custom name . P.S the apps got initialized in runtime with dynamic name.Santosh Nepal– Santosh Nepal2022-09-08 10:02:35 +00:00Commented Sep 8, 2022 at 10:02
Add a comment
|
1 Answer
How to initialise multiple apps in Firebase Admin SDK
There is a specific section in the doc for this case. It shows the following code:
// Initialize the default app
initializeApp(defaultAppConfig);
// Initialize another app with a different config
var otherApp = initializeApp(otherAppConfig, 'other');
console.log(getApp().name); // '[DEFAULT]'
console.log(otherApp.name); // 'other'
// Use the shorthand notation to retrieve the default app's services
const defaultAuth = getAuth();
const defaultDatabase = getDatabase();
// Use the otherApp variable to retrieve the other app's services
const otherAuth = getAuth(otherApp);
const otherDatabase = getDatabase(otherApp);
I want to know up to how many app can we initialize in one project
I don’t have the answer to this question (i.e. I don’t know about any such limit) but you can initialise more than two apps.
1 Comment
Frank van Puffelen
For #2) There is no documented limit on how many app instances you can initialize, nor is there a limit hard-coded into the SDKs or back-ends. There probably is a physical limit, but nothing is imposed by the Firebase SDKs (that I know of).