Vercel Deploy Problems - Cookies not detected?
I just deployed my app to vercel and m ycookies are no longer detected?
I sign in e.g. with a. magic link, i see my cookies in the application but i dont get redirected or whatever
When i run it locally i do get redirected, only difference is one is deployed on vercel and the other isnt
12 Replies
any logs in vercel?
these the logs

did you set env for cookies etc?
can you check if there is any set-cookie in these logs?
those are the only logs
i do have a database hook at session.create will check if that is dying
yea
also add logs, maybe to debug it further
I guess i wonder do i need to set up the advanced cookie config too

On the trusted origin side do you just need the hostname? e.g.
https://my-app.vercel.app/
https://my-app.vercel.app/api/auth
https://my-app.vercel.app is enough for trustedOrigins
or whatever your domain is
can it also support wildcards? e.g. *.vercel.app
as vercel has quite a few different domains
Doesnt seem to be the problem i see the full session object when i console.log it
As i can see th ecookies i suppose next possible thing to look at is my middlware?
Ok so my problem is with the useSecureCookies stuff
Setting it true locally causes the same issue im seeing on vercel
then disabling it locally it is expected (it is enabled by default in production according to docs)
hm weird
check
BETTER_AUTH_URL
incase it's set to localhost on vercel as well. You don't need to manually set secure
cookies. Better Auth will detect that based on the enviroment and the base url.Yup that was the problem, completly forgot to check its set on auth.ts, only had it set on the client :D
Thank you