This question is essentially the same as question 44799104, only that I provide my index.js (and the only answer there was not helpful, as I do include 'exports').
In short, I have deployed my function successfully,
but it does not show in the console. Where am I going wrong? Here is my index.js:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
var delayInMilliseconds = 5000;
exports.copyRoom= functions.database.ref('/RoomsOwn/${AuthUid}').onWrite((event) => {
var uid = event.params.AuthUid;
console.log('AuthID: ' + uid);
var object = event.data.val();
console.log('Whole Object: ', object);
setTimeout(function() {
return admin.database.ref('/RoomsOthers/${uid}').set(object);
}, delayInMilliseconds);
});
const onCreateUser = ....
and then exporting the function likemodule.exports = onCreateUser;
. But when I triedexports.onCreateUser
it worked! – Rifling