fix: guard against null data.user in invite-admin-user Edge Function

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 13:04:41 +03:00
parent 1954577d6a
commit 9ab728d721
@@ -52,6 +52,13 @@ Deno.serve(async (req) => {
}); });
} }
if (!data?.user) {
return new Response(JSON.stringify({ error: 'Invite sent but user data unavailable' }), {
status: 500,
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
});
}
return new Response( return new Response(
JSON.stringify({ id: data.user.id, email: data.user.email }), JSON.stringify({ id: data.user.id, email: data.user.email }),
{ headers: { ...corsHeaders, 'Content-Type': 'application/json' } }, { headers: { ...corsHeaders, 'Content-Type': 'application/json' } },