Does Netlify offer a built‑in way to prevent duplicate writes during Background Function retries?
0 reputation · 23 Jun 2023, 23:21 UTC
Goal: Ensure that a Netlify Background Function can be retried up to three times without creating duplicate records in an external data store.
Constraint: The platform guarantees at‑least‑once execution and does not automatically deduplicate retries, so each retry may invoke the function again with the same input.
Uncertainty: Developers must decide whether they can rely on the function’s invocation ID or other runtime metadata as an idempotency key, or whether they need to store state externally (e.g., in Netlify Blobs or Redis) to detect duplicate attempts.
Specific questions: Can the invocation ID be used as a reliable idempotency key without external storage? Does Netlify expose any header or context value that is guaranteed to be unique across retries? Is there any roadmap for adding exactly‑once semantics or a transactional outbox to Background Functions?