Repository navigation
Idempotency middleware for Hono, so a retried POST stops charging twice #1957
violetta98
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A dropped connection means the client retries. Without something in the way, that second request charges the card again.
The retry replays the first response and never reaches your handler. Node, Bun and Deno, with Redis, Postgres, Mongo or DynamoDB behind it in production.
A worker that dies mid-request doesn't wedge the key either: it expires on its own, and the late write from the dead worker is rejected.
Zero dependencies, Apache-2.0: https://github.com/idemkit/idemkit
If you find it useful, a star would be much appreciated.
All reactions