Debugging

How to debug webhooks that fail or never arrive

A step-by-step checklist for debugging webhooks: did it arrive, did the signature pass, what did your endpoint answer, and how to recover the events you missed.

By the Relaya team · · 9 min read

Ask four questions, in order

A webhook "not working" is almost always one of four failures. Debugging goes fastest when you check them in the order the request travels, and stop at the first one that fails:

  1. 01
    Did the provider send it? Is the event subscribed, and does the provider's log show a delivery attempt?
  2. 02
    Did it reach your server? DNS, TLS, firewalls and redirects can all stop it on the way.
  3. 03
    Did it pass verification? A signature mismatch looks like a broken integration from the outside.
  4. 04
    What did your endpoint answer, and what happened next? A timeout or a 500 means retries, duplicates, or a gap.

1. Did the provider send it?

Start at the source. Every major provider shows recent deliveries for each endpoint, with the response it got back.

  • Is the endpoint subscribed to this event type? payment.captured and order.paid are separate subscriptions in Razorpay; Stripe and Shopify work the same way.
  • Is it the right mode? Test-mode events only go to endpoints registered in test mode, and live to live.
  • Did the provider disable the endpoint? After enough consecutive failures, many providers stop sending until you re-enable it.

2. Did it reach your server?

If the provider shows an attempt but your logs show nothing, the request died in between. Usual causes:

  • Redirects. An http:// URL redirected to https://, or a missing trailing slash, turns into a 301. Most senders don't follow redirects for a POST, and the ones that do may drop the body. Register the final URL.
  • TLS problems. An expired certificate or a missing intermediate certificate fails the handshake before your code runs.
  • Firewalls and WAFs. Bot protection, country blocks and rate limits often catch webhook traffic. Check what your CDN or WAF blocked.
  • Body size limits. A proxy that rejects bodies over 1 MB will drop large order or invoice payloads with a 413.

Send yourself a request to separate "my server is unreachable" from "my code rejects it":

Does the endpoint answer at all?
curl -i -X POST https://example.com/webhooks/razorpay \
  -H "Content-Type: application/json" \
  -d '{"event":"ping"}'
# Expect a 4xx for the bad signature, NOT a timeout, redirect or HTML error page.

3. Did it pass verification?

Signature failures are the most common "it worked yesterday" bug. The provider signs the exact bytes it sent; anything that changes those bytes, or a different secret, breaks the match.

  • Verify the raw body. Frameworks that parse JSON first (Express's express.json(), for example) re-serialise it and the HMAC no longer matches. Read the raw bytes for webhook routes.
  • Use the right secret. Stripe's is per endpoint (whsec_…) and differs between test and live; Razorpay's is the secret you typed when creating the webhook, not your API key secret.
  • Check your clock. Stripe and Cashfree sign a timestamp, and receivers reject requests older than a few minutes. A server clock that drifted makes every request look stale.

Our guide to signature verification covers each provider's scheme and the mistakes in detail.

4. What did your endpoint answer?

Senders treat any non-2xx answer, or no answer within their timeout, as a failure and retry later. That causes two different bugs:

  • Timeouts that "succeed". Your code finished the work but answered after the sender gave up. The sender retries and you process the event twice. Answer 200 as soon as the event is stored, and do the slow work in a background job.
  • Errors that become gaps. A bug that throws a 500 for one event type fails every retry. When the provider gives up, the event is gone unless you kept a copy.

Make the handler idempotent: record each event ID you have processed, and skip ones you've seen.

An idempotent handler (Node.js)
app.post('/webhooks/payments', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!verify(req.body, req.headers)) return res.status(400).end()
  const event = JSON.parse(req.body)
  const fresh = await db.insertIgnoreDuplicate('processed_events', { id: event.id })
  if (fresh) await jobs.enqueue('handle-payment', event)   // slow work happens later
  res.status(200).end()                                     // answer fast, every time
})

When the payload itself changed

Sometimes everything above is fine: the request arrived, verified, and your code answered 200, but did the wrong thing. A provider renamed a field, made one optional, or sent "amount": "499.00" where it used to send 49900. These bugs don't throw errors; they quietly write wrong data. The fix is to compare each payload with the shape you depend on, and alert when a critical field changes.

Recovering the events you missed

  1. 01
    Fix the cause first, or the replay fails the same way.
  2. 02
    List exactly which events were affected: by type, by time window, by the field that broke.
  3. 03
    Resend them with the same idempotency key they had originally, so anything your endpoint already processed is skipped.
  4. 04
    Check that every resend got a 2xx before you call it fixed.

Providers help to a point: some let you resend single events from their dashboard or list past events through their API. Without a record of your own, though, step 2 is guesswork.

How Relaya makes this a two-minute job

Relaya receives your webhooks before your code does, so each of the four questions has an answer on one screen. Every event is stored with its headers, payload and signature result. Every forward to your endpoint shows each attempt and the response. Breaking payload changes open an incident listing the affected events, and a replay shows exactly what it will resend before it runs.

QuestionWhere Relaya answers it
Did it arrive?Events: every request, including rejected ones
Did it verify?The signature result on each event: valid, invalid or missing
What did my endpoint answer?Forwarding: each attempt, status code and response time
Did the payload change?Incidents: one per broken field, with every affected event
How do I recover?Replay: preview first, same Idempotency-Key on every resend

Stop finding out from your customers.

Point your first webhook at Relaya today. Try the Team plan free for 7 days.