Urgent.News

What's breaking now, across thousands of outlets.

Tech

Testing webhook retries deterministically: a fault sequence per Idempotency-Key

Two weeks ago I wrote about a webhook receiver that can be slow and flaky on purpose. A reader left a comment that changed how I think about it: "a 10% error rate tells me my sender retries. It doesn't tell me the retry is correct , and I can't put 10% in CI." He was right. The bug I actually care about is a specific one: My service sends the webhook. The receiver gets it, processes it, and the…

In a recent scenario, a webhook receiver was designed to be slow and unreliable on purpose. A reader's comment led to a significant realization: a 10% error rate indicates sender retries, but it doesn't confirm whether those retries are executed correctly and cannot be verified through continuous integration (CI). The real issue at hand is that the service sends a webhook, the receiver processes it, and before the service reads a 200 response, the connection is lost.

Upon retrying with the same idempotency key, the receiver either creates a second order or recognizes the key and responds with "already done." To address this, a new mode was introduced, allowing a list of steps to be walked per key. The endpoint accepts a JSON list of steps, and for each distinct idempotency key, the steps are followed in order.

The first call with a key executes step one, the second call with the same key executes step two, and a new key restarts from step one. The three actions available are 'respond', 'drop', and 'timeout'. The 'respond' action sends a status, body, and optional delay, while 'drop' logs the request and cuts the connection without delivering a body.

The 'timeout' action holds the connection for up to 30 seconds before cutting it. After the last step, 'on_end' determines the next action, with the default being to repeat the last step indefinitely. Other considerations include hashing the key before storage, the limitations on header names, and the handling of responses. The endpoints run on Cloudflare Workers, with a free plan offering 3 endpoints, 30 requests per minute, and 500 requests per day, with a limit of 20 steps per sequence.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

★ The iPhones 18 Pro

It’s the best version of the most successful product ever made. And yet by nature of *how* the iPhone 18 Pro improved in the last year, it’s not exciting at all.

  • iPhone 18 Pro marks Apple's 20th flagship generation
  • iPhone 18 Pro and Pro Max likely as flagship models
  • iPhone Duo potentially takes flagship spot in future anniversaries

A 200 response can still break your API integration

An API can be up, fast, and still break every client that depends on it. A field changes from an object to an array. An optional property disappears. A path is renamed in the OpenAPI document.

  • API responses can change shape without breaking DNS or latency
  • Four types of API changes: availability, shape, contract, and behavior
  • Detailed JSON diffs pinpoint breaking changes for developers

Implementing Degraded Node.js Health Checks for API Credentials and Tiers

A readiness endpoint for a Node.js metering service should report the last verified capability state, not call the account API on every probe.

  • Store last confirmed capability state and cache with short lifespan
  • Refresh account credentials outside main request path
  • Separate liveness, readiness, and capability refresh checks

More from Friday 18 September →