@rtorcato/supabase-common / withRetry
Function: withRetry()
withRetry<
T>(fn,options?):Promise<T>
Defined in: errors.ts:119
Run fn, retrying while it fails with a retryable error — thrown, or carried
on a resolved { data, error } result. The supabase-js client already retries
GET/HEAD itself and never retries writes; this is for writes. Backoff is
exponential (no jitter). Returns the last result, or rethrows the last throw.
A write that fails mid-flight may or may not have committed, so use it for
idempotent writes (upsert, a client-supplied id) or rolled-back errors like
40001 / 40P01.
await withRetry(() => supabase.from('t').upsert(row))
Type Parameters
T
T
Parameters
fn
() => Promise<T>
options?
WithRetryOptions = {}
Returns
Promise<T>