【发布时间】:2019-03-30 03:13:26
【问题描述】:
我正在尝试创建一个云函数来写入 firebase 数据库。它应该非常简单。我想编写并返回 200。他们给出的示例在 then 回调中进行了重定向,但我不想重定向。不幸的是,我的函数无限期挂起,并将相同的消息写入数据库 3、4、5、6 次。
我很确定我的退货操作不正确。我试图从 then 回调中返回 res.status = 200,但这也不起作用。
这是我目前拥有的:
exports.createEvent = functions.https.onRequest((req, res) => {
const name = req.query.name;
const description = req.query.description;
const location = req.query.location; //json? lat/lng, public,
const date = req.query.date;
// Push the new message into the Realtime Database using the Firebase Admin SDK.
return admin.database().ref('/Event')
.push({name : name, description : description, location : location, date : date});
});
【问题讨论】:
标签: firebase google-cloud-functions