admin管理员组文章数量:1416051
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 badges1 Answer
Reset to default 2the "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
本文标签:
版权声明:本文标题:next.js - I have a Next js 15 Console Warning: "Error: Route"" uses cookies().get , cookies() should 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745247717a2649632.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论