1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Add article about handling failed webhook deliveries (#42956)

Co-authored-by: Jess Hosman <1183847+jhosman@users.noreply.github.com>
This commit is contained in:
Sarah Edwards
2023-09-20 16:16:48 -07:00
committed by GitHub
parent 7d1b11ed10
commit ec447f81c1
4 changed files with 35 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ topics:
## About redelivering webhooks ## About redelivering webhooks
You may want to redeliver a webhook to help you test your application or to recover from server downtime. You can redeliver webhook deliveries that occurred in the past 30 days. You may want to redeliver a webhook to help you test your application or to recover from server downtime. You can redeliver webhook deliveries that occurred in the past 30 days. {% data variables.product.company_short %} does not automatically redeliver failed deliveries.
## Redelivering repository webhooks ## Redelivering repository webhooks
@@ -91,8 +91,6 @@ Only the owner of the sponsored account can redeliver sponsorship webhooks for t
Only enterprise owners can redeliver webhooks in that enterprise. Only enterprise owners can redeliver webhooks in that enterprise.
{% ifversion ghes or ghae %}You can use the {% data variables.product.company_short %} web interface or the REST API to redeliver global webhooks. For more information about using the REST API to redeliver webhooks, see "[AUTOTITLE](/rest/enterprise-admin/global-webhooks)."{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.hooks-tab %} {% data reusables.enterprise-accounts.hooks-tab %}

View File

@@ -93,8 +93,6 @@ Only the owner of the sponsored account can view deliveries for sponsorship webh
Only enterprise owners can view deliveries for webhooks in that enterprise. Only enterprise owners can view deliveries for webhooks in that enterprise.
{% ifversion ghes or ghae %}You can use the {% data variables.product.company_short %} web interface or the REST API to view recent deliveries for global webhooks. For more information about using the REST API to view recent deliveries, see "[AUTOTITLE](/rest/enterprise-admin/global-webhooks)."{% endif %}
{% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.access-enterprise %}
{% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.settings-tab %}
{% data reusables.enterprise-accounts.hooks-tab %} {% data reusables.enterprise-accounts.hooks-tab %}

View File

@@ -0,0 +1,33 @@
---
title: Handling failed webhook deliveries
shortTitle: Handling failed deliveries
intro: '{% data variables.product.company_short %} does not automatically redeliver failed webhook deliveries, but you can handle failed deliveries manually or by writing code.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
---
## About webhook delivery failures
A webhook delivery can fail for multiple reasons. For example, if your server is down or takes longer than {% ifversion fpt or ghec %}10{% else %}30{% endif %} seconds to respond, {% data variables.product.company_short %} will record the delivery as a failure.
{% data variables.product.company_short %} does not automatically redeliver failed deliveries.
## Handling delivery failures
You can manually redeliver failed deliveries. For more information, see "[AUTOTITLE](/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks)."
You can also write a script that checks for failed deliveries and attempts to redeliver any that failed. Your script should run on a schedule and do the following:
- Use the {% data variables.product.company_short %} REST API to fetch data about any webhook deliveries that were attempted since the last time that your script ran. For more information, see "[AUTOTITLE](/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook)," "[AUTOTITLE](/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook)," and "[AUTOTITLE](/rest/apps/webhooks#list-deliveries-for-an-app-webhook)."
{% ifversion fpt %}There are no API endpoints to get data about {% data variables.product.prodname_marketplace %} webhooks or {% data variables.product.prodname_sponsors %} webhooks.{% endif %}{% ifversion ghec %}There are no API endpoints to get data about {% data variables.product.prodname_marketplace %} webhooks, {% data variables.product.prodname_sponsors %} webhooks, or global webhooks.{% endif %}{% ifversion ghes or ghae %}There are no API endpoints to get data about global webhook deliveries.{% endif %}
- Look at the fetched data to see if any deliveries failed. The data for a failed delivery will have a `status` value that is not `OK`.
- Use the {% data variables.product.company_short %} REST API to redeliver any deliveries that failed. For more information, see "[AUTOTITLE](/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook)," "[AUTOTITLE](/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook)," and "[AUTOTITLE](/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook)."
If a webhook delivery fails repeatedly, you should investigate the cause. Each failed delivery will give a reason for failure. For example, if the delivery failure indicates that {% data variables.product.company_short %} couldn't connect to the host, you should verify that the domain portion of the webhook URL that you specified resolves to an IP address.

View File

@@ -12,6 +12,7 @@ children:
- /creating-webhooks - /creating-webhooks
- /handling-webhook-deliveries - /handling-webhook-deliveries
- /securing-your-webhooks - /securing-your-webhooks
- /handling-failed-webhook-deliveries
- /disabling-webhooks - /disabling-webhooks
- /best-practices-for-using-webhooks - /best-practices-for-using-webhooks
--- ---