get-session returning null with 200 status code

I'm running into an issue locally where occasionally the session will be returned as null for a signed in user. This leads to all getSession calls failing even with a valid session. I'm using Upstash redis as my secondary storage, and looking at the logs it doesn't appear that the session is even being access from the database (not seeing logs in either the "get" function in my better auth config or any requests through the Upstash console). This will happen periodically when developing locally, then resolve itself after a few minutes and page refreshes. Looking at the browser cookies, the session token doesn't change, the getSession calls just seem to start actually accessing the db again. Any advice on debugging this? This seems similar to github issue: https://github.com/better-auth/better-auth/issues/2055, but my requests are coming from a client component, and the getSession calls are failing in regular nextjs route handlers (as well as the get-session auth api call).
GitHub
better-auth/better-auth
The most comprehensive authentication framework for TypeScript - better-auth/better-auth
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?