https://pact.io logo
a

Alan Still

07/26/2022, 12:26 PM
Hi Team 👋 . I’m having some issues with a new Webhook that does not seem to be Authorising with the GitHub url i am trying to trigger. Testing the trigger always returns a 404 from GitHub. We have other webhooks (all still working) that use the same auth token (stored in Secrets) and I can also trigger the GitHub repo using a simple curl request from my Terminal. I have also regenerated our GitHub Auth Token, just to see if that could help. Happy to provide links to our webhooks on pactflow, if you think it will help. Thanks
m

Matt (pactflow.io / pact-js / pact-go)

07/26/2022, 10:53 PM
We’ll definitely need to see the webhook configuration to understand why it’s failing.
There should be webhook logs in the UI that show the outbound request and response, is there anything there that indicates what is going on?
a

Alan Still

07/27/2022, 8:48 AM
I can’t see anything too obvious in the logs. Here is a snippet of a failing webhook
DEBUG: Webhook context {"base_url":"<https://moo-print.pactflow.io>","event_name":"test"}
INFO: HTTP/1.1 POST <https://api.github.com/repos/moo-print/manufacture-psp-adapter/dispatches>
INFO: accept: application/vnd.github.v3+json
INFO: user-agent: Pact Broker v2.101.0
INFO: content-type: application/json
INFO: authorization: [REDACTED]
[2022-07-26T11:40:06Z] INFO: host: <http://api.github.com|api.github.com>
[2022-07-26T11:40:06Z] INFO: content-length: 352
[2022-07-26T11:40:06Z] INFO: {"event_type":"pact_provider_webhook","client_payload":{"pact_url":"<https://moo-print.pactflow.io/pacts/provider/mfg-psp/consumer/mfg-work-order-notification/pact-version/9b6a9a249b42f255bca7a678185531badfedcfe3/metadata/Y3ZuPTNjM2ViMTY1YWMxMzg1OWU1OWNlZDk1Mjk4YTgxODE2Y2U0ZGNmZGUmY3Z0W109cGFjdC10ZXN0Jnc9dHJ1ZQ>","consumer_version_branch":"pact-test"}}
INFO: HTTP/1.1 404 Not Found
INFO: server: <http://GitHub.com|GitHub.com>
INFO: date: Tue, 26 Jul 2022 11:40:06 GMT
INFO: content-type: application/json; charset=utf-8
INFO: content-length: 125
INFO: x-github-media-type: github.v3; format=json
INFO: {"message":"Not Found","reference/repos#create-a-repository-dispatch-event"}
INFO: Webhook execution failed
and this snippet, for another (working) webhook, calls out to the same GitHub repo,
DEBUG: Webhook context {"base_url":"<https://moo-print.pactflow.io>","event_name":"test"}
INFO: HTTP/1.1 POST <https://api.github.com/repos/moo-print/manufacture-psp-adapter/dispatches>
INFO: accept: application/vnd.github.v3+json
INFO: user-agent: Pact Broker v2.101.0
INFO: content-type: application/json
INFO: authorization: [REDACTED]
INFO: host: <http://api.github.com|api.github.com>
INFO: content-length: 344
INFO: {"event_type":"pact_provider_webhook","client_payload":{"pact_url":"<https://moo-print.pactflow.io/pacts/provider/mfg-psp/consumer/mfg-order-event-log/pact-version/d61886c80617f08cce3a8db75915587782bfa54e/metadata/Y3ZuPWY1ZDBiYjhkNGM2ODIyNjVmNzczYmVlYzcxMDk2NDdjZjk2OGVmOWYmY3Z0W109cGFjdC10ZXN0Jnc9dHJ1ZQ>","consumer_version_branch":"pact-test"}}
[2022-07-26T11:40:49Z] INFO: HTTP/1.1 204 No Content
INFO: server: <http://GitHub.com|GitHub.com>
INFO: date: Tue, 26 Jul 2022 11:40:49 GMT
INFO: x-oauth-scopes: repo, workflow
INFO: x-accepted-oauth-scopes:
INFO: x-github-media-type: github.v3; format=json
We use the same auth token to access GitHub, which is stored in our Pactflow Secrets
m

Matt (pactflow.io / pact-js / pact-go)

07/27/2022, 9:57 AM
Are you editing via the UI? One guess is the 404 is because of token permissions. Sometimes browsers auto complete the basic auth section
I know a repository dispatch can 404 if the token is incorrect, so that would be my guess. Also check the webhook team is also associated with the secret and is able to use it
a

Alan Still

07/27/2022, 12:24 PM
Yes, I have made a few edits through the UI, and yes it looks like the Basic Auth section had been auto-completed! Thank you for that, I don’t think I would have ever searched that!
m

Matt (pactflow.io / pact-js / pact-go)

07/27/2022, 12:39 PM
You're welcome. We need to find a better way here, sorry for that confusion!
Cc: @Shuying Lin
4 Views