[GH-ISSUE #896] Cookie cache refresh #25811

Closed
opened 2026-04-17 16:04:25 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @leosilberg on GitHub (Dec 15, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/896

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Follor the docs on sessions

Current vs. Expected behavior

After the cookie cache expires the server calls the DB but no new cookie with the session data is set. session.ts

Would it be possible to set the cookie data with the refreshed session before the response

What version of Better Auth are you using?

1.0.20

Provide environment information

Hono 
Expo

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

const auth = new BetterAuth({
    session: {
        cookieCache: {
            enabled: true,
            maxAge: 5 * 60 // Cache duration in seconds
        }
    }
});

Additional context

No response

Originally created by @leosilberg on GitHub (Dec 15, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/896 ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce Follor the docs on [sessions]( https://www.better-auth.com/docs/concepts/session-management#session-caching) ### Current vs. Expected behavior After the cookie cache expires the server calls the DB but no new cookie with the session data is set. [session.ts](https://github.com/better-auth/better-auth/blob/b98d17720e6fa642090a88bd8c6a0997647a9275/packages/better-auth/src/api/routes/session.ts#L145) Would it be possible to set the cookie data with the refreshed session before the [response](https://github.com/better-auth/better-auth/blob/b98d17720e6fa642090a88bd8c6a0997647a9275/packages/better-auth/src/api/routes/session.ts#L233) ### What version of Better Auth are you using? 1.0.20 ### Provide environment information ```bash Hono Expo ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript const auth = new BetterAuth({ session: { cookieCache: { enabled: true, maxAge: 5 * 60 // Cache duration in seconds } } }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-17 16:04:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25811