Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: catch errors on setall in rscs (#27762)

Charis484393f66621
diff --git a/apps/docs/content/guides/auth/server-side/nextjs.mdx b/apps/docs/content/guides/auth/server-side/nextjs.mdx
index fe9f3f98ab5..f240a9bb205 100644
--- a/apps/docs/content/guides/auth/server-side/nextjs.mdx
+++ b/apps/docs/content/guides/auth/server-side/nextjs.mdx
@@ -137,7 +137,15 @@ export function createClient() {
return cookieStore.getAll()
},
setAll(cookiesToSet) {
- cookiesToSet.forEach(({ name, value, options }) => cookieStore.set(name, value, options))
+ try {
+ cookiesToSet.forEach(({ name, value, options }) =>
+ cookieStore.set(name, value, options)
+ )
+ } catch {
+ // The `setAll` method was called from a Server Component.
+ // This can be ignored if you have middleware refreshing
+ // user sessions.
+ }
},
},
}