Skip to content

Vercel Session Cookies not available #8

@rrdesignweb

Description

@rrdesignweb

Hi there, mate,
Thanks for sharing your solution here,

I know you haven't touched this code for sometime, but I am utilitizing it at the moment on a personal project I am working on.
using Qwik, Prisma and Supabase

All fine works perfect on my localhost, but deploy vercel/netlify edge has been a bit of a headaches, fixed most of them..

Issue i am having now is that the session cookies are not available and trying to understand why that is exactly as I have protected routes and dependant on that being present e.g if (!session || (session?.expires_at && new Date(session.expires_at * 1000) < new Date()) ) { throw event.redirect(302, PATHS.signIn); } so I keep getting redirected to the sign page after login.

I am wondering if it has anything to do with the onRequest middleware? https://github.com/wmalarski/qwik-trpc-supabase/blob/master/src/lib/qwik-supabase.ts#L201 firing at wrong time? I was reading up on the package @supabase/ssr, they have a tutorial on setting this up with nextjs, it reads:

Be careful when protecting pages. The server gets the user session from the cookies, which can be spoofed by anyone. Always use supabase.auth.getUser() to protect pages and user data. Never trust supabase.auth.getSession() inside server code such as middleware. It isn't guaranteed to revalidate the Auth token. It's safe to trust getUser() because it sends a request to the Supabase Auth server every time to revalidate the Auth token. https://supabase.com/docs/guides/auth/server-side/nextjs so maybe some possible updates there ?

Will keep going on it, see where i end up, any help woulld be appreciated ! cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions