[drizzleAdapter] refresh a session won't update the updatedAt column #1246

Closed
opened 2026-03-13 08:29:56 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ImSingee on GitHub (May 22, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Create a new project, set session.updateAge to a short one (e.g. 1min) to reproduce the issue easily
  2. Sign in a user
  3. Wait for some time (more than session.updateAge), and get /api/auth/get-session to trigger a session refresh
  4. See the returned object (or the database). The expiresAt is updated, but the updatedAt is still the same as createdAt

Current vs. Expected behavior

The updatedAt should be updated automatically.

What version of Better Auth are you using?

1.2.8

Provide environment information

- OS: macOS & Linux

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

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
   database: drizzleAdapter(db, {
    provider: "pg",
  }),
  session: {
    expiresIn: 60 * 60 * 24 * 90, // 90 days
    updateAge: 60 * 1, // 1 minutes
  },
});

Additional context

This issue might also affect other tables.

While users can resolve it through manual database hook configuration, updatedAt is a built-in feature of better-auth and ideally should not require user intervention.

Originally created by @ImSingee on GitHub (May 22, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Create a new project, set session.updateAge to a short one (e.g. 1min) to reproduce the issue easily 2. Sign in a user 3. Wait for some time (more than session.updateAge), and get /api/auth/get-session to trigger a session refresh 4. See the returned object (or the database). The expiresAt is updated, but the updatedAt is still the same as createdAt ### Current vs. Expected behavior The updatedAt should be updated automatically. ### What version of Better Auth are you using? 1.2.8 ### Provide environment information ```bash - OS: macOS & Linux ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "pg", }), session: { expiresIn: 60 * 60 * 24 * 90, // 90 days updateAge: 60 * 1, // 1 minutes }, }); ``` ### Additional context This issue might also affect other tables. While users can resolve it through manual database hook configuration, `updatedAt` is a built-in feature of better-auth and ideally should not require user intervention.
Author
Owner

@devallibus commented on GitHub (May 22, 2025):

Can confirm, it is also happening on my end.

@devallibus commented on GitHub (May 22, 2025): Can confirm, it is also happening on my end.
Author
Owner

@Bekacru commented on GitHub (May 22, 2025):

PR -> #2747

@Bekacru commented on GitHub (May 22, 2025): PR -> #2747
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1246