Next.js Discord

Discord Forum

Supabase SSR Auth + Next.js 15 Canary. Async cookie questions

Answered
American Crocodile posted this in #help-forum
Open in Discord
Avatar
American CrocodileOP
With the latest change to async cookie in Canary I'm getting this error from my supabase next.js auth ssr setup (https://supabase.com/docs/guides/auth/server-side/nextjs)

In route (route here....) a cookie property was accessed directly with cookies().getAll(). cookies() should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis

that is after using the codemods, there are 2 uses of cookies().getAll() one on the middleware and one to create the supabase server client.

Is there any way to avoid that error, or that is a missing functionality on the supabase side?
Answered by joulev
looks like you need to make your server createClient an async function
View full answer

3 Replies

Avatar
looks like you need to make your server createClient an async function
Answer
Avatar
American CrocodileOP
Hum, that sounds right. So i can await the cookie instead of using the the codemod change with the unsafe type.
Thanks