© 2026 Hedgehog Software, LLC
error : "\"[object Object]\" is not valid JSON"
export const test = async (name) => { const { data, error } = await supabaseClient.functions.invoke('hello', { body: { foo: name } }); console.log('data: ', data); return data?.message; };
serve(async (req) => { // This is needed if you're planning to invoke your function from a browser. if (req.method === 'OPTIONS') { return new Response('ok', { headers: corsHeaders }) } try { const { body } = await req.json() const data = { message: `Hello ${JSON.stringify(body)}!`, } return new Response(JSON.stringify(data), { headers: { ...corsHeaders, 'Content-Type': 'application/json' }, status: 200, }) } catch (error) { return new Response(JSON.stringify({ error: error.message }), { headers: { ...corsHeaders, 'Content-Type': 'application/json' }, status: 400, }) } })