I just started getting an error when trying to deploy a google cloud HTTP function using:
gcloud functions deploy http_function --trigger-http
And now I'm getting an error like this:
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.
]
The function deployed fine earlier and I've only fiddled with the some code inside, nothing that I believe should give me this error.
My cloud function looks like this:
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;
}
}
If anyone has some insight as to what might cause this error, I'd greatly appreciate it, because I'm struggling to find info on it?
EDIT: It only seems to happen sometimes, so now I definitely believe it's something wrong with gcloud.