Node.js命令提示符只是忽略了这个函数,而其他函数正在部署,我也没有收到任何错误。
var database = admin.database();
var postsRef = database.ref("/posts");
postsRef.on('child_added', addOrUpdateIndexRecord);
function addOrUpdateIndexRecord(dataSnapshot) {
// Get Firebase object
var firebaseObject = dataSnapshot.val();
// Specify Algolia's objectID using the Firebase object key
firebaseObject.objectID = dataSnapshot.key;
// Add or update object
index.saveObject(firebaseObject, function(err, content) {
if (err) {
throw err;
}
console.log('Firebase object indexed in Algolia', firebaseObject.objectID);
});
}
答案 0 :(得分:1)
如果它是数据库触发器功能,那么您使用的语法不正确。尝试这样做:
exports.updateposts = functions.database.ref("posts/")
.onWrite(event => {
//Do whatever you want to do with trigger
});