Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

cloudbuild trigger webhook error code 400

Hello,

I have this error from cloudbuildapi and i do not understand what is the invalid argument.

{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}

(URL removed by Staff)

0 2 1,086
2 REPLIES 2

Can you share the URL but without your token or project ID?
Have you successfully deployed your Cloud Build?

Suppose you have, I am currently reading the troubleshooting documents for 4XX client errors, which say "(...) You've specified an incorrect trigger ID." as a possible cause for why your webhook trigger isn't firing.

Something else that stands out to me is, Webhook triggers require both an API key for authentication and a Secret Manager secret for authoriz....

Have you granted your Load Test Service Account the role/Secret Manager Secret Accessor?
Have you chosen in load-test-build-trigger Advanced dropdown to use a Service Account with the same role?

And, the documentation says that "Note: Only the service account specified on your trigger will be used for builds executed by triggers. If you specified a service account in your build config, it will be ignored during build execution when using triggers.".

I look forward to your response.

robmin
New Member

I was also getting a similar error, for me the issue was that I was not passing the `application/json` header and `{}` as a body.

So instead of

```

curl -X POST "https://cloudbuild.googleapis.com/v1/projects/<PROJECT-NAME>/triggers/<TRIGGER-NAME>:webhook?key=<SECRET>&se
cret=<SECRET>"
```
 
should be
 
```
curl -X POST -H "application/json" "https://cloudbuild.googleapis.com/v1/projects/<PROJECT-NAME>/triggers/<TRIGGER-NAME>:webhook?key=<SECRET>&se
cret=<SECRET>" -d "{}"
```