I am trying to send push notification from mongodb function using firebase (fcm).
I have the following code working on node.js, which i am trying to replicate in function:
const admin = require(‘firebase-admin’);
let serviceAccount = require(’./serviceAccountKey.json’);
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
Uploaded all the relevant external dependencies.
Now, the problem is i don’t know how the following code will work:
let serviceAccount = require(’./serviceAccountKey.json’);
this line is looking for external json file (unfortunately, not able to upload it as dependencies)
I suppose this answer is considered depricated now. What is the new way to deal with that? I am dealing with the same problems, that Firebase requires either a File or changing a environment variable in the shell. Both things are not an option as far as I know.