Category: Supabase and databases

Supabase SSR: Server Cannot Read the Logged-In Session

Read this guide in Polish

Client Component recognizes user, but Server Component returns guest view.

How to identify the source of the problem

Check cookies, server-side and middleware customer settings to update the session.

Compare the result for the authorized and unauthorised user, project name and exact error code.

Repair steps

Use the recommended SSR package and properly read cookies on the server without leaking token.

How to Test Solution

Refresh the page keeps the session on both the client and server side.

Security and restrictions

Change permissions and scheme first on test data with backup. Do not put service role in your browser.