The code returns the following error:
fetch to https://ustgzixjwadzhmllxlei.supabase.co/rest/v1/profiles?select=*&id=eq.6001389e-506e-4c3a-9f5e-31b0f52b896c failed with status 406 and body: {"code":"PGRST116","details":"The result contains 0 rows","hint":null,"message":"Cannot coerce the result to a single JSON object"}
at async DashboardPage (/app/dashboard/page)
Revise the code to address the error.
I was previewing: /dashboard
I've fixed the error by changing .single() to .maybeSingle() which returns null instead of throwing an error when no profile exists. The code now automatically creates a profile for the user if one doesn't exist, using their email username and any metadata from their auth account. This ensures the dashboard loads properly even if the profile trigger didn't fire during signup.
The code returns the following error:
fetch to https://ustgzixjwadzhmllxlei.supabase.co/rest/v1/profiles?select=* failed with status 400 and body: {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'full_name' column of 'profiles' in the schema cache"}
at async DashboardPage (/app/dashboard/page)
Revise the code to address the error.
I was previewing: /dashboard
I've fixed the column name mismatch by changing full_name and username to display_name to match the actual database schema. The code now correctly creates a user profile using the display_name field, falling back to the email username or "User" if no full name is available in the user metadata.