❓ Help with better-auth: cookieCache not persisting after maxAge expires

Hey everyone, I'm using better-auth and I have cookieCache enabled (true) with maxAge set to 60 * 1 (1 minute). When I first log in, two cookies are set: better-auth.session_token better-auth.session_data When I call the API route api/auth/get-session, the session is correctly read from the cookie, and no DB query is made (confirmed using Drizzle's query logger in the console). However, after maxAge expires: The better-auth.session_data cookie is destroyed. A DB query is made to fetch session data (which is expected). But the session_data cookie is not re-set, so on every subsequent request, it keeps querying the DB again and again. Is this a bug in better-auth? Or am I missing something in the setup? Would appreciate any help or clarification on this! 🙏 Would you like me to help you debug this behavior or write a GitHub issue template for it as well?
3 Replies
Andrei
Andrei5d ago
I'm experiencing the same but only when signed in with social providers, it works fine with email/password
Karthickeyan
KarthickeyanOP4d ago
Yes, I also use social providers only (google oauth)
Andrei
Andrei4d ago
I double checked it yesterday with Microsoft, same as with Google - no session server calls at all @Ping could you assist, please. Is it a bug in a Vue package? I presume that's because it's not making any calls to the server when logged in with any social provider, I described the behavior here (with video): https://discord.com/channels/1288403910284935179/1370151660416012498

Did you find this page helpful?