Deploying Google Cloud Functions ResponseError: The updateMask field contains event_trigger but it is not present in CloudFunction resource

Viewed 702

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.

2 Answers

The error has been fixed now, see: https://status.cloud.google.com/incident/cloud-functions/18002

"The issue with Google Cloud Functions experiencing errors when updating functions via gcloud has been resolved for all affected users as of Tuesday, 2018-09-11 09:10 US/Pacific. We will conduct an internal investigation of this issue and make appropriate improvements to our systems to help prevent or minimize future recurrence."

I get the same when i try to deploy a pubsub triggered func, the error occurs on every other try. I just re-execute the CLI command and then it works.

Related