question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best practices for tracking duplicate webhooks

See original GitHub issue

I was wondering if there’s an accepted way to handle duplicate hooks, currently I’m hashing the response data & storing that in Redis & checking against it to see if I’ve already handled a hook.

I’m just confused as there seems to be no identifier to say “these hooks were meant to do this action on this object” that we can use to check for duplicates, since each webhook/attempt has a unique identifier.

e.g. a video.asset.errored has happened twice in the same day on the same object - so they’re not duplicate hooks, but have duplicate data. Maybe I’m missing something here - thanks in advance for any pointers.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dylanjhacommented, Dec 16, 2020

Hi @cwqt I agree it’s an important issue. We just try to keep the issues in this repo specific to the node SDK.

I double checked this functionality, duplicates and re-attempts will have the same top level id (which is a unique identifier for the event). Thanks for the docs feedback, we can definitely make that more clear, thank you!

1reaction
cwqtcommented, Dec 15, 2020

Appreciate the write-up, but I think this is an important issue that shouldn’t be sidelined into support channels, especially when money is on the line depending on if a hook is accidentally re-handled.

If duplicate webhook notifications are sent for an event (again, this should be incredibly rare), the event’s id should be the same in both request bodies.

Right okay, that’s just not made clear in the documentation, it’s really ambiguous that & not clear that duplicate webhooks (not a re-attempt) will have the same Id, even now you say they should, not they will

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practices for using webhooks | Stripe Documentation
We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the...
Read more >
Webhook best practices - Shopify.dev
Respond quickly · Track failures · Recover webhooks · Avoid debounces · Ignore duplicates · Manage delays · Implement reconciliation jobs · Use...
Read more >
Best Practices for Managing Webhook Data Streams - SparkPost
In order to avoid duplicate data getting into your reporting database, use the the unique event_id to dedup data before adding into your...
Read more >
Shopify Webhooks Best Practices Revised and Extended
With this identifier, you can track webhooks that have already been processed and skip them to avoid duplicating their impact on your ...
Read more >
How to handle duplicate events in your code (or, why ...
At least once delivery #. Postmark makes a best effort for “at least once delivery” of webhooks. This is in contrast to “exactly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found