我正在尝试将文档添加到firestore子集合中,但发现无法加载错误。该日志有时会显示超时错误,而其他时候则不会。
这是功能日志上的错误消息:
函数执行耗时60007毫秒,状态为:“超时”
在大多数情况下,没有错误消息,只是文档加载失败,如提供的图像所示。
有什么想法吗? 这是我正在运行的代码。
exports.postRepos = (req,res) => {
const newRepos = {
userHandle: req.user.handle,
createdAt: new Date().toISOString()
};
db.collection('userss')
.doc(req.params.handle)
.collection('log')
.add(newRepos)
.then((doc) => {
const resRepos = newRepos;
resRepos.ReposId = doc.id;
res.json(resRepos);
})
.catch((err) => {
res.status(500).json({error: "Server error. Something went wrong"});
console.error(err);
});
}