Next.js Discord

Discord Forum

Changes to cookies in Nextjs15?

Unanswered
Dimax posted this in #help-forum
Open in Discord
Previously, I was doing this:
export const updateClient = async (clientId: number, clientData: Partial<Client>) => { const supabase = createServerActionClient({ cookies }); try { // Get current user with proper JWT validation const { data: { user } } = await supabase.auth.getUser(); if (!user) { return { success: false, error: 'User not authenticated' }; }
But it looks like in Nextjs15, we now have to await the cookies first, so im guessing we need to do something like this.
export const addNewClient = async (clientData: Partial<Client>) => { const cookieStore = await cookies(); const supabase = createServerActionClient({ cookies: () => cookieStore });

But Im getting some type and build errors:
Type 'ReadonlyRequestCookies' is missing the following properties from type 'Promise<ReadonlyRequestCookies>': then, catch, finally, [Symbol.toStringTag]ts(2739)
index.d.ts(50, 14): The expected type comes from the return type of this signature.
clientsApi.ts(118, 56): Did you mean to mark this function as 'async'?
Ctrl+click to open in new tab
const cookieStore: ReadonlyRequestCookies

0 Replies