© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
3 replies
orcun

Supabase SSR / Right way to implement Server Component client

Hey folks,

I'm working on setting up Supabase clients in my NextJS 14 project using Supabase SSR for auth. I'm using middleware to refresh sessions as recommended. I've encountered confusion with different recommendations for server and server component client implementations:

1) Official example for creating a server component, it drops every exception during set and remove, only uses get. (https://github.com/vercel/next.js/blob/canary/examples/with-supabase/utils/supabase/server.ts)

2) Supabase ssr docs, server component client only implements get method, doesn't implement anything else. Server actions client, on the other hand, has all the cookie related methods implemented. (https://supabase.com/docs/guides/auth/server-side/creating-a-client?environment=server-component)

I initially used #1, and it worked fine. However, as I explore #2, it seems like it should work, but it doesn't. #2 throws exceptions saying server components cant set cookies.

Dropping the errors is concerning to me in case I do something wrong without even realizing.

Can someone help me understand what's going on?

-Who is trying to set cookies for server component clients? (I tried to debug but it only goes up to SupabaseAuthClient)
-Why is supabase server client example dropping exceptions ok for middleware refresh case?
GitHub
next.js/examples/with-supabase/utils/supabase/server.ts at canary ·...
The React Framework. Contribute to vercel/next.js development by creating an account on GitHub.
next.js/examples/with-supabase/utils/supabase/server.ts at canary ·...
Creating a Supabase client for SSR | Supabase Docs
Configure Supabase client to use Cookies
Creating a Supabase client for SSR | Supabase Docs
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Supabase SSR client with Clerk
SupabaseSSupabase / help-and-questions
7mo ago
The right way to initialize a client using the `ssr` package?
SupabaseSSupabase / help-and-questions
3y ago
A good way to get GoTrue types on Supabase/ssr?
SupabaseSSupabase / help-and-questions
3y ago
How to disable supabase ssr logs
SupabaseSSupabase / help-and-questions
6mo ago