find session doesnt read field name override #127

Closed
opened 2026-03-13 07:34:28 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @darklight9811 on GitHub (Oct 23, 2024).

Describe the bug
If you change the key of a field (ex: account.userId to account.id_user), findSession won't get the correct field.

The bug is on this line:
ba83ae8071/packages/better-auth/src/db/internal-adapter.ts (L235-L236)

To Reproduce

  1. change the userId field in account to another name
  2. try to get the session

Expected behavior
to successfully get the current session

Originally created by @darklight9811 on GitHub (Oct 23, 2024). **Describe the bug** If you change the key of a field (ex: `account.userId` to `account.id_user`), findSession won't get the correct field. The bug is on this line: https://github.com/better-auth/better-auth/blob/ba83ae8071c86e4cbaac6594792abfd1d2cf0069/packages/better-auth/src/db/internal-adapter.ts#L235-L236 **To Reproduce** 1. change the userId field in account to another name 2. try to get the session **Expected behavior** to successfully get the current session
Author
Owner

@darklight9811 commented on GitHub (Oct 23, 2024):

Sorry for not contributing with a PR, I'm still learning my way around the codebase

@darklight9811 commented on GitHub (Oct 23, 2024): Sorry for not contributing with a PR, I'm still learning my way around the codebase
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#127