Idempotent route handlers in Next.js, one wrapper #17730
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.
Uh oh!
There was an error while loading. Please reload this page.
A dropped connection on the way back from
/api/chargemeans the browser retries, and your handler runs a second time. Route handlers are just Fetch handlers, so this wraps one.A retry carrying the same
Idempotency-Keyreplays the first response and never reaches the handler. Node runtime, with Redis, Postgres, Mongo or DynamoDB behind it in production.Zero dependencies, Apache-2.0: https://github.com/idemkit/idemkit
If you find it useful, a star would be much appreciated.
All reactions