Cannot delete user when sessions are in secondary storage instead of database
When a secondary storage is setup, so sessions are there instead of main database, I try to delete a user but it seems better-auth still expects a sessions table in the main database. Is this expected or a bug?
For context:
- Secondary storage (Upstash Redis)
- Main database (postgreSQL with DrizzleORM)
- No cookie caching
7 Replies
2025-02-05T15:58:04.295Z ERROR [Better Auth]: BetterAuthError [Error [BetterAuthError]: [# Drizzle Adapter]: The model "session" was not found in the schema object. Please pass the schema directly to the adapter options.] {
cause: undefined
}
session table is currently considered to always exist in the main db. But it should actually be optional when secondary storage is provided. Will be patched in the next release
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
the user data will still be stored in a database and if none provided it uses the memory as a database. so, secondary storage still requires a db to store a user data.
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Not exactly. If the session is active and the cookie is already in the browser, it should work since it doesn’t fetch the primary db at that point. But, user data is only stored in the primary database. So, for example, if the session in the secondary storage expires, the user can no longer log in.
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View