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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745247717a4618487.html
评论列表(0条)