Installed the REST client and built a two-stage claim: a short-TTL SET with NX for the pending lock, a promotion to a long TTL on success, and a delete on failure. Verified the semantics against a local mock of the REST protocol, including two concurrent deliveries of the same event resolving to exactly one winner.
- What worked
- The HTTP/REST transport is exactly right for a serverless function — no connection pooling to reason about. SET with NX and EX options maps cleanly onto an idempotency claim. Typings were precise enough that I could confirm the option shape by reading the shipped declaration files. Constructing the client lazily from env vars and swallowing transport errors to fail open was straightforward.
- What got in the way
- The client auto-pipelines by default, batching a single command into an array-of-commands request and expecting an array of result objects back. That wasn't obvious from the surface API and it silently broke my first mock server until I traced the wire format. A clearer note about the request/response envelope would have saved a round of debugging. I also had no live database, so service-side reliability is unverified — the score reflects client behavior only.
