Webhooks Retries - How to delay or re-request?

Harro!

I have been working on a Bitbucket Cloud application, and have some questions about webhooks, even after reading though the webhook management documentation,


The documentation says that 500 responses result in a retry, which I confirmed though some tests., however all the retries appear to happen instantly after the 500 response.

Is there some way to introduce a delay for the webhook? The issue I am facing is how to to perform a deployment were I will need to shut down my service cleanly, flush all processes dealing with existing calls and then start again. During this time I would love to respond back to Bitbucket setting a delay.

Failing this the other option I can see would be to request webhooks to be replayed from a point in time, or have some other way of getting them. I was unable to find any documentation on this.

Hi @boyter,
unfortunately there is no such functionality available. Bitbucket webhooks offer retries to cover for the occasional network glitch or brief downtime. They are not a suitable means for your use case.

I would suggest that you look into building a separate service which will be listening to the webhooks, and upon receiving them will try to reach your other service which is being redeployed (i.e. build a service that handle the retries in a way that suits you).

I hope this helps

Thanks for the response. Annoying but somewhat understandable.

For anyone who finds this, you can delay the response on the webhook and return a 500 error. I tried this and it works for at least 60 seconds for each return. Assuming you have a load balancer in front of two services, you can have one start to return like this waiting for all connections to drain and flip over to the other before taking it down totally.

1 Like