Webhooks time-out

For what I see, my webhook shows

Delivery timed out, server did not reply after 6.0 seconds.

but when I see my endpoint, it answered 200 OK, it is just that it took longer than 6 seconds to response. Is it possible to set up the time out to wait longer? or not to disable with failures, right now I have to check every day that the hook is not disabled.

Hello! The 6 second timeout is not configurable, in order to ensure that the service can be suitably resourced for all webhook consumers.
A webhook should only be disabled automatically if it has 10 failed deliveries in the past 24 hours. Is this the case for you?
If you’re just exceeding the processing time too often (ie. your consumer service doesn’t actually have any availability issues) you could consider re-designing the service logic so that it can respond respond more quickly, and do any longer-running processing asynchronously.

Our webhooks keep failing because of the time out, yes, the delay comes from another service and we cannot speed it up. The biggest problem is the disconnection. At the end of the day I can check if the endpoint answered 200 even if the hook failed, but we don’t have time to check everyday if the hook is disconnected. We are really happy using the hooks, it saves us time of going through events, but scripts don’t need daily supervision just to keep them working. Is it no possible to add the disconnection as an option when creating hooks?

1 Like

Hi! If I understand correctly, you want to keep the status from this external service associated to the delivery (even if it takes more than 6 seconds for that service to process the request). Maybe this can help: https://developer.shotgunsoftware.com/3d448f5e/?title=Webhooks+(Coming+soon!)#acknowledgements

The basic idea is that you record the delivery id and respond to the webhook trigger asap.
When the external service responds, you can update the delivery status based on the response you received from the external service.


I’m trying your idea with this code:

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {}'.format(auth_res['access_token'])

params = {
    "acknowledgement": "Update to avoid timeout error."

res = requests.put('{}/api/v1/webhook/deliveries/{}'.format(base_url, <x-sg-delivery-id>'),
                   data = json.dumps(params),
                   headers = headers)

And I got a response:

{'data': {},
 'links': {'self': '/api/v1/webhook/deliveries/<x-sg-delivery-id>'}}

It seems this code works without errors but it seems it doens’t work propery.
Did I lack any points to do that? Would you mind giving me proper code?

At this moment I’m using threads to return a response with one thread while working in a second one and it seems to work ¯_(ツ)_/¯

1 Like

So, final solution I found to shoot first, logic later. Threading was cool until I went for containers, so what I did is to make a middleware for my server that would handle the requests after returning and it works just fine in containers. So, if someone is using gunicorn, threading will work fine, if you are using uwsgi, go for middleware.

1 Like