大家好我对android编程很新,几乎不知道js编码,我按照教程创建了一个firebase函数,当我这样做时似乎有一个错误,我的问题可能是愚蠢但我需要帮助,我从user_id的第二行得到一个错误(我把一个```只为插图:
exports.sendNotification = functions.database.ref('/n/{user_id}/{notification_id}').onWrite(event => {
const user_id = event.params.```user_id```;
const notification_id = event.params.```notification_id```;
这是我的数据库:
-n
--ti9MmffcXLT38uagj5J3fTqshjf1
----LBlr1He51ln-yTyQOdM
--------f: "FjVudM9BBahhCd0eta9lWS8tUoY2"
--------t : 5
我收到此错误:
TypeError: Cannot read property 'user_id' of undefined
at exports.sendNotification.functions.database.ref.onWrite.event (/user_code/index.js:28:31)
at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27)
at next (native)
at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36)
at /var/tmp/worker/worker.js:710:26
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
我的双手被束缚在这里,我真的需要完成这个,任何帮助都会被批评:)