在下面的代码中:
exports.sendRequestNotification = functions.database.ref('/Notifications/{notificationid}/longitude').onWrite((event) => {
const lat = admin.database().ref('/Users/B8r1Xc8cAOVGOiptlFOz45fzxSm1');
return Promise.all([lat]).then((results) =>{
const latitud = results[0];
console.log('hi ',latitud.data.child('name').val());
});
});
我正在尝试获取特定用户的名称并将其注销,但它给了我这个错误:
TypeError: Cannot read property 'child' of undefined
at Promise.all.then (/user_code/index.js:60:35)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
我在这篇文章中尝试了解决方案但它也没有用(Access db data in Cloud Functions for Firebase)
有人能帮助我吗?
答案 0 :(得分:4)