Valu
BABetter Auth
•Created by Valu on 3/15/2025 in #help
getSessionCookie() always null | Next.js 15.2
In my middleware I am using
getSessionCookie()
to check if a user has a session cookie.
My middleware looks like this (shortend):
When using npm run dev
I can access the protected routes only if I am logged in and everything works just as expected.
If using npm run start
after a build, `getSessionCookie()`` is always returning null and I cannot access the protected routes even when I am logged in and the session cookie is set.
Any help is really appreciated. Thanks!5 replies