Next.js Discord

Discord Forum

cookies not coming in fetch call from a server component

Unanswered
Sedge Wren posted this in #help-forum
Open in Discord
Sedge WrenOP
I'm trying to setup supabase auth in my app and created a function to get the user after creating supabase client in a 'use server' headed file. I've included the api routes in the middleware. Now I want to use this function in my route handlers. If I call the api from a client component using fetch, the user is coming. However if I call the fetch in server component, the user is not coming in the route handlers. I can see the user in server component. I've included credentials:"include" in the fetch call too, still the user is not coming. My middleware file matches the api routes too. Any help is greatly appreciated! Thanks for your time.

2 Replies