Menu

How I Handle Idempotency Keys in a .NET 8 API for AWS Lambda
📰

How I Handle Idempotency Keys in a .NET 8 API for AWS Lambda

DEV Community: dotnet·Martin Pisacreta·about 11 hours ago
#d30UVqEA
#devtodotnet#devto#dev#order#repository
Reading 0:00
15s threshold

A client sends an order, loses the connection and retries. Did the first request fail before creating anything, or did only the response disappear? I cannot answer that question by generating another order ID. I need a way to recognize the operation the client already requested.

I built a .NET 8 minimal API sample around that boundary. It accepts an Idempotency-Key , stores a normalized request fingerprint with an order response, and replays that response when the same request returns. Reusing the key with different order data produces HTTP 409.

The sample is configured for AWS Lambda behind API Gateway, with a SAM template. Its nine self-tests pass on Windows, with a Release build that has zero warnings and errors. The template was reviewed, but neither built with SAM nor deployed.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.