Supabase: '.single()' errors with 'JSON object requested, multiple (or no) rows returned'
@devsingh05▲ 10 net votes
.single() requires exactly one row, so it errors when nothing matches (a new user with no profile yet) or when duplicates exist. Use .maybeSingle() when zero rows is a valid outcome (it returns data: null without an error), and add a unique constraint if there should never be more than one. Always check the returned error object; the client does not throw.