JavaScript: Set an abort signal

Set the AbortSignal for the fetch request.

You can use this to set a timeout for the request.

Parameters

Examples

Aborting requests in-flight

const ac = new AbortController()
ac.abort()
const \{ data, error \} = await supabase
  .from('very_big_table')
  .select()
  .abortSignal(ac.signal)

Set a timeout

const \{ data, error \} = await supabase
  .from('very_big_table')
  .select()
  .abortSignal(AbortSignal.timeout(1000 /* ms */))