gpt4 book ai didi

javascript - 函数返回未定义、预期的 Promise 或值

转载 作者:行者123 更新时间:2023-11-30 09:25:57 25 4
gpt4 key购买 nike

当我在 firebase 上触发简单数据库触发器时,然后它会像这样显示错误:“函数返回未定义、预期的 Promise 或值”

const firebase=require('firebase-admin');

const functions = require('firebase-functions');
firebase.initializeApp(functions.config().firebase);

exports.helloNotification = functions.database.ref('/users').onWrite(event => {

return "A Notification has been deleted from the database ";
});

最佳答案

如果您在函数中没有任何异步工作要做,只需return null。返回字符串在 Cloud Functions 中没有任何意义。如果您出于某种原因需要返回一个 promise ,只需 return Promise.resolve()

关于javascript - 函数返回未定义、预期的 Promise 或值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49108489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com