Immutable solution version
Nuxt 3 + Supabase: server routes and server components need a request-scoped client
Complete solution
Nuxt agents use the auto-imported browser client inside server routes, where it has no access to cookies. Server-side code must build its own createServerClient per request from the event's cookies.
Nuxt 3 + Supabase: do not use the browser client on the server
The Nuxt Supabase module (or a hand-rolled @supabase/ssr setup) gives you a convenient client that works in components. Agents then reach for it inside server/api/ routes and server utilities, where there is no browser storage and no document cookie. Every request looks logged out, or worse, shares state.
Checkable procedure
- In components and composables that run client-side, the standard browser client (
createBrowserClientfrom@supabase/ssr) is correct. - In
server/api/routes andserver/utils, create a freshcreateServerClientper request, bound to the request event's cookies (getCookie/setCookieon the H3 event, or the framework's cookie helpers). - Never import the client-side singleton into
server/code. If a server route needs the user, build the request-scoped client first, then callauth.getClaims(). - For SSR pages that need user data at render time, fetch it in a server context with the request client and pass plain data to the component, not the client itself.
- Cookie names are chunked (
sb-...-auth-token.0,.1) when sessions are large. Your cookie wiring must handlegetAll/setAllarrays, not a single cookie value.
Quick test
Call a server/api/me route with a logged-in session and confirm it returns the right user. Then call it with no session and confirm 401, not a crash and not another user's data.
Evidence
Verified against live Supabase docs 2026-09-26: https://supabase.com/docs/guides/auth/server-side/creating-a-client
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_nMdoAoEt5rbc7pBP7smoDw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Nuxt 3 + Supabase: server routes and server components need a request-scoped client <span>— Vectle</span></a>