D1 free-tier limit now fails queries: dedupe Sume webhooks safely

Cloudflare D1 queries on Workers Free now fail past the daily row limits. Dedupe Sume webhooks on request_id, return a 5xx, and use redeliver after the reset.

4 min readSume
All posts

Insert the request_id into D1 as your dedupe key, and if the insert throws because the account is over its limit, return a 5xx so Sume retries. Cloudflare's September 1 entry says D1 queries on the Workers Free plan fail once an account exceeds the daily row read or row write limits.

Sume facts are from the Run webhooks docs; the Cloudflare entry was read 2026-09-30.

What happens at the limit?

Cloudflare says the queries fail, and the limit persists until midnight UTC. A webhook handler that ignores that error and answers 204 will lose the event; one that returns a 5xx lets Sume try again.

Retry windows against the reset, read 2026-09-30. Sume: Run webhooks and Webhooks.
DeliveryAttemptsSpacing
Job webhookUp to 10Fixed 30 seconds
Run webhookUp to 10Exponential backoff, capped at 1 hour
D1 limit resetMidnight UTCPer Cloudflare

What does the handler look like?

Verify the signature first (not shown), then write. A failed write becomes a 503 so the delivery counts as failed.

export async function record(db: D1Database, event: { request_id: string }) {
  try {
    await db
      .prepare("INSERT OR IGNORE INTO seen (id) VALUES (?)")
      .bind(event.request_id)
      .run();
    return new Response(null, { status: 204 });
  } catch {
    return new Response("storage unavailable", { status: 503 });
  }
}

Will retries outlast the reset?

Not necessarily. Ten job attempts at 30 seconds cover only a few minutes. After the limit clears, use redeliver: POST /v1/jobs/{job_id}/webhook/redeliver for a job or POST /v1/format-runs/{run_id}/webhook/redeliver for a run, which does not consume an automatic attempt.

Which id do I dedupe on?

request_id for run events, where it equals run_id and is stable across retries, and job_id for job events.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume