Open witoszekdev opened 2 years ago
We should add a debugging section in https://docs.saleor.io/docs/3.x/developer/extending/apps/asynchronous-webhooks.
Debugging webhooks deliveries can be done by this query:
query { webhook(id: "...") { id eventDeliveries(first: 10) { edges { node { status eventType attempts(last: 10) { edges { node { duration status response responseStatusCode responseHeaders requestHeaders } } } payload } } } } }
It will return:
Example response:
{ "data": { "webhook": { "id": "V2ViaG9vazozOQ==", "eventDeliveries": { "edges": [ { "node": { "status": "FAILED", "eventType": "TRANSACTION_ACTION_REQUEST", "attempts": { "edges": [ { "node": { "duration": 1.833384, "status": "FAILED", "response": "Error while processing refund", "responseStatusCode": 500, "responseHeaders": "{\"Content-Length\": \"29\", \"Date\": \"Thu, 30 Jun 2022 08:54:05 GMT\", \"Etag\": \"\\\"1d-EFjXubUKaWiYx28t3H9UWN1XV6s\\\"\", \"Server\": \"Caddy\", \"Content-Type\": \"text/plain; charset=utf-8\"}", "requestHeaders": "{\"Content-Type\": \"application/json\", \"X-Saleor-Event\": \"transaction_action_request\", \"X-Saleor-Domain\": \"master.staging.saleor.cloud\", \"X-Saleor-Signature\": \"<hidden>\", \"Saleor-Event\": \"transaction_action_request\", \"Saleor-Domain\": \"master.staging.saleor.cloud\", \"Saleor-Signature\": \"<hidden>\"}" } }, { { "node": { "duration": 0, "status": "FAILED", "response": "HTTPSConnectionPool(host='saleor.proxy.witoszek.dev', port=443): Read timed out. (read timeout=10)", "responseStatusCode": null, "responseHeaders": "null", "requestHeaders": "null" } } ] }, "payload": "{\"transaction\": {\"id\": \"VHJhbnNhY3Rpb25JdGVtOjE0Ng==\", \"reference\": \"ord_pk61qs\", \"type\": \"mollie-creditcard\", \"refundIds\": null, \"authorizedAmount\": {\"amount\": 0.0, \"currency\": \"USD\"}, \"chargedAmount\": {\"amount\": 42.92}, \"voidedAmount\": {\"amount\": 0.0}, \"refundedAmount\": {\"amount\": 0.0}}, \"action\": {\"actionType\": \"REFUND\", \"amount\": 42.92}}" } } ] } } }, "extensions": { "cost": { "requestedQueryCost": 1, "maximumAvailable": 50000 } } }
Developers can also retry the delivery of the webhook (keep in mind that the payload can contain outdated data, because payload content is created at the moment event happens - not when event delivery is requested)
mutation { eventDeliveryRetry(id: "...") { delivery { status eventType payload attempts(first: 10) { edges { node { duration status response responseHeaders responseStatusCode requestHeaders } } } } } }
Internal task: SALEOR-7527
We should add a debugging section in https://docs.saleor.io/docs/3.x/developer/extending/apps/asynchronous-webhooks.
Debugging webhooks deliveries can be done by this query:
It will return:
Example response:
Developers can also retry the delivery of the webhook (keep in mind that the payload can contain outdated data, because payload content is created at the moment event happens - not when event delivery is requested)