Reputation: 829
I am using same firestore database for multiple apps like iOS and android. And i have done backend for push notification using node js. Right now, I am trying to deploy backend in ec2 engine using AWS. While running server temporally in in terminal, I used command node index.js and console output shows Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail.
here the screenshot of database
here is the console output from terminal
here is the code used in node js
admin.initializeApp(functions.config().firebase);
admin.initializeApp({
credential: admin.credential.cert({
projectId: '',
clientEmail: '',
privateKey: ''
}),
databaseURL: ''
});
Upvotes: 2
Views: 759
Reputation: 750
Assign the initialization to a variable and add a second argument of any string. This will let it know it is a secondary initialization. Take a look at the documentation.
var second = admin.initializeApp({
credential: admin.credential.cert({
projectId: '',
clientEmail: '',
privateKey: ''
}),
databaseURL: ''
}, 'secondary');
Upvotes: 2