AdapterUser.id
is a string, but pg-adapter uses an integer
#10875
Labels
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
invalid reproduction
The issue did not have a detectable valid reproduction URL
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Adapter type
@auth/pg-adapter
Environment
Reproduction URL
n/a
Describe the issue
In the database a user's ID is stored as an
integer
: https://github.com/nextauthjs/next-auth/blob/%40auth/pg-adapter%400.7.2/packages/adapter-pg/schema.sql#L42This seems at odds
AdapterUser.id
, which says thatid
is astring
: https://authjs.dev/reference/core/adapters#adapteruserThis inconsistency makes it difficult to use user IDs in TypeScript. Other data models use
id: number
, matching what's in theusers
table; when comparisons to anAdapterUser.id
(such assession.user?.id
, during authorization policy checks) the compiler reports a type mismatch between the user ID stored in the database and that on the session.How to reproduce
n/a
Expected behavior
The type of
id
is consistent everywhere, facilitating usage (especially comparison) from application code.The text was updated successfully, but these errors were encountered: