next.js - I have a Next js 15 Console Warning: "Error: Route"" uses cookies().get , cookies() should

i have this Next js version with supabase :"@supabaseauth-helpers-nextjs": "^0.10.0&qu

i have this Next js version with supabase :

"@supabase/auth-helpers-nextjs": "^0.10.0",
"@supabase/supabase-js": "^2.48.1",
"next": "15.1.6",
"react": "^19.0.0","

i'm currently building my auth for my application, everything works well for me, but i get this console warning : "Error: Route "/dashboard" used cookies().get('sb-mcoiqtohcgcgdidkeful-auth-token'). cookies() should be awaited before using its value. Learn more: ;

i am not sure what to do , if i need to ignore this , or if this is a major issue.

this happens for me in server components when trying to access my cookies like this : "

const cookieStore = cookies()
const supabase = createServerComponentClient({ cookies: () => cookieStore })",


i tried using async await with it , with many variants : 1)

const cookieStore = await cookies();

const supabase = createServerComponentClient({
    cookies: () => Promise.resolve(cookieStore), // Ensures async handling
  });
 const supabase = createServerComponentClient({
    cookies: async () => await cookies(),
  });
 const cookieStore = await cookies()
 const supabase = createServerComponentClient({ cookies: async () => cookieStore })


but none of these work , i get this error "Error: nextCookies.get is not a function

i have this Next js version with supabase :

"@supabase/auth-helpers-nextjs": "^0.10.0",
"@supabase/supabase-js": "^2.48.1",
"next": "15.1.6",
"react": "^19.0.0","

i'm currently building my auth for my application, everything works well for me, but i get this console warning : "Error: Route "/dashboard" used cookies().get('sb-mcoiqtohcgcgdidkeful-auth-token'). cookies() should be awaited before using its value. Learn more: https://nextjs./docs/messages/sync-dynamic-apis"

i am not sure what to do , if i need to ignore this , or if this is a major issue.

this happens for me in server components when trying to access my cookies like this : "

const cookieStore = cookies()
const supabase = createServerComponentClient({ cookies: () => cookieStore })",


i tried using async await with it , with many variants : 1)

const cookieStore = await cookies();

const supabase = createServerComponentClient({
    cookies: () => Promise.resolve(cookieStore), // Ensures async handling
  });
 const supabase = createServerComponentClient({
    cookies: async () => await cookies(),
  });
 const cookieStore = await cookies()
 const supabase = createServerComponentClient({ cookies: async () => cookieStore })


but none of these work , i get this error "Error: nextCookies.get is not a function

Share Improve this question asked Feb 3 at 6:15 user29473441user29473441 11 silver badge2 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

the "const cookieStore = await cookies()" should work! since next.js 15 this APIs are now dynamic, but i think the problem is in the "createServerComponentClient", check the supabase documentation because they deprecated the "auth-helpers" and now you need to use "@supabase/ssr" i'll share you the link

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745247717a4618487.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信