I've tried to check for session on server side in my NextJS project. I've used supabaseService client and also "createServerSupabaseClient" from @supabase/auth-helpers-nextjs both of those checks returns session null even tho I'm logged in in the client...
export async function getServerSideProps(
context: GetServerSidePropsContext<{ tournamentId: string }>
) {
// Create authenticated Supabase Client
const supabaseServ = await supabaseService.auth.getSession();
const supabase = await createServerSupabaseClient(context);
// Check if we have a session
const {
data: { session },
} = await supabase.auth.getSession();
console.log("sessions", supabaseServ, session);
if (!session)
return {
redirect: {
destination: "/",
permanent: false,
},
};
}
Does anyone know why am I unable to getSession on SSR? Also I've console logged the cookies and it seems that I do have the JWT cookie in the request context...