我刚刚尝试使用以下方式部署Google云端HTTP功能时遇到错误:
gcloud functions deploy http_function --trigger-http
现在我收到这样的错误:
ERROR: (gcloud.functions.deploy) ResponseError: status=[400], code=[Bad Request], message=[The request has errors
Problems:
The updateMask field contains event_trigger but it is not present in CloudFunction resource.
]
该函数早先部署得很好,我只是弄乱了里面的一些代码,我认为没有什么能给我这个错误。
我的云功能如下所示:
exports.http_function = (req, res) => {
if (req.method === 'POST') {
// some code and then
res.json(jsonVariable);
} else {
const error = new Error('Only POST requests are accepted');
error.code = 405;
console.error(error);
res.status(error.code || 500).send(error);
throw error;
}
}
如果有人对可能导致此错误的原因有所了解,我会非常感激,因为我很难找到相关信息吗?
编辑:它似乎有时只发生,所以现在我绝对认为gcloud有问题。
错误现已修复,请参阅:https://status.cloud.google.com/incident/cloud-functions/18002
“截至美国/太平洋地区2018-09-11 09:10周二,所有受影响的用户都已解决了通过gcloud更新功能时出现问题的Google Cloud Functions问题。我们将对此问题进行内部调查,并进行适当的改进我们的系统有助于防止或减少未来的复发。“
当我尝试部署pubsub触发的func时,我得到相同的结果,每次尝试都会出错。我只是重新执行CLI命令然后它工作。