每当我使用firebase deploy时,它都会成功创建数据,但是每当我使用firebase serve时,它就会去捕获函数!我正在使用的功能是:
exports.createUser = functions.https.onRequest((req, res) => {
const newUser = {
body: req.body.body,
userName: req.body.userName,
createdAt: admin.firestore.Timestamp.fromDate(new Date())
};
admin
.firestore().collection('screems').add(newUser)
.then(doc => {
return res.json({
message: `document ${doc.id} created successfully`
});
})
.catch(err => {
res.status(500).json({
error: 'something went wrong'
});
console.error(err);
});
});
我使用邮递员检查 API,但它总是说“出了点问题”;
烙印99
相关分类