JavaScript: Invokes a Supabase Edge Function.

Invokes a function

Invokes a Supabase Edge Function.

Parameters

Examples

Basic invocation.

const \{ data, error \} = await supabase.functions.invoke('hello', \{
  body: JSON.stringify(\{ foo: 'bar' \})
\})

Specifying response type.

const \{ data, error \} = await supabase.functions.invoke('hello', \{
  responseType: 'text',
  body: JSON.stringify(\{ foo: 'bar' \})
\})

Passing custom headers.

const \{ data, error \} = await supabase.functions.invoke('hello', \{
  headers: \{
    "my-custom-header": 'my-custom-header-value'
  \},
  body: JSON.stringify(\{ foo: 'bar' \})
\})