[GH-ISSUE #775] [Backend] UserID BigInt support. #8425

Closed
opened 2026-04-13 03:29:30 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @songispm on GitHub (Dec 5, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/775

Need BigInt Support, Many companies use the Snowflake ID or other BigInt values as userID.

But it has error When I set the field to BigInt:

with secondaryStorage:
image

no secondaryStorage:
image

User table:
image

Account Table:
image

Originally created by @songispm on GitHub (Dec 5, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/775 Need BigInt Support, Many companies use the Snowflake ID or other BigInt values as userID. But it has error When I set the field to BigInt: with secondaryStorage: ![image](https://github.com/user-attachments/assets/2b79fefd-2139-4805-8c5f-8fb6d7181c08) no secondaryStorage: <img width="1605" alt="image" src="https://github.com/user-attachments/assets/bdca194a-f2b1-4776-98ed-941b4c6c5574"> User table: <img width="1148" alt="image" src="https://github.com/user-attachments/assets/d33770c6-5321-4012-91e0-25f8d250b4a7"> Account Table: <img width="1146" alt="image" src="https://github.com/user-attachments/assets/8200c2ec-45e8-42cc-bebc-fa3a823841c2">
GiteaMirror added the locked label 2026-04-13 03:29:30 -05:00
Author
Owner

@songispm commented on GitHub (Dec 5, 2024):

with version 1.0.10

<!-- gh-comment-id:2520619345 --> @songispm commented on GitHub (Dec 5, 2024): with version 1.0.10
Author
Owner

@songispm commented on GitHub (Dec 5, 2024):

And use MySQL 8.0
And use prisma
And use hono.js with node.js (@hono/node-server)

<!-- gh-comment-id:2520627692 --> @songispm commented on GitHub (Dec 5, 2024): And use MySQL 8.0 And use prisma And use hono.js with node.js (@hono/node-server)
Author
Owner

@songispm commented on GitHub (Dec 5, 2024):

Temporary, By a Hack

Just sign-in worked, I don't know if there are any other error, I will continue to test them later.

maybe not a good way:

BigInt.prototype.toJSON = function () {
    return this.toString();
};
<!-- gh-comment-id:2521165217 --> @songispm commented on GitHub (Dec 5, 2024): Temporary, By a Hack Just sign-in worked, I don't know if there are any other error, I will continue to test them later. maybe not a good way: ``` BigInt.prototype.toJSON = function () { return this.toString(); }; ```
Author
Owner

@windily-cloud commented on GitHub (Apr 28, 2025):

After testing, it was found that if we forcibly use bigint as the ID type, user registration and login functions work normally, but updating user information fails. This occurs because the id in the WHERE clause of the update statement remains a string type, which results in errors.

Ultimately, i opted to use strings as id

<!-- gh-comment-id:2834314060 --> @windily-cloud commented on GitHub (Apr 28, 2025): After testing, it was found that if we forcibly use bigint as the ID type, user registration and login functions work normally, but updating user information fails. This occurs because the id in the WHERE clause of the update statement remains a string type, which results in errors. Ultimately, i opted to use strings as id
Author
Owner

@dosubot[bot] commented on GitHub (Jul 28, 2025):

Hi, @songispm. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The issue requests support for BigInt in the backend, particularly for user IDs like Snowflake IDs.
  • Errors occur when using BigInt fields; context and screenshots were provided.
  • You mentioned using MySQL 8.0, Prisma, and hono.js with Node.js, and shared a workaround by modifying the BigInt prototype.
  • @windily-cloud tested BigInt for IDs and found registration and login work, but updating user info fails due to type mismatches.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3127930489 --> @dosubot[bot] commented on GitHub (Jul 28, 2025): Hi, @songispm. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - The issue requests support for BigInt in the backend, particularly for user IDs like Snowflake IDs. - Errors occur when using BigInt fields; context and screenshots were provided. - You mentioned using MySQL 8.0, Prisma, and hono.js with Node.js, and shared a workaround by modifying the BigInt prototype. - @windily-cloud tested BigInt for IDs and found registration and login work, but updating user info fails due to type mismatches. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository. If so, you can keep the discussion open by commenting here. - If there is no further activity, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@ping-maxwell commented on GitHub (Sep 30, 2025):

We should have bigint support, @windily-cloud what adapter are you using?

<!-- gh-comment-id:3350104274 --> @ping-maxwell commented on GitHub (Sep 30, 2025): We should have bigint support, @windily-cloud what adapter are you using?
Author
Owner

@dosubot[bot] commented on GitHub (Dec 30, 2025):

Hi, @songispm. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary

  • You reported issues with backend support for BigInt user IDs causing errors, sharing schema examples and error screenshots.
  • You use MySQL 8.0, Prisma, and hono.js, and shared a temporary workaround by overriding BigInt's toJSON method.
  • Contributor windily-cloud confirmed registration and login work with BigInt IDs, but updates fail due to SQL type mismatches, leading to using strings instead.
  • Maintainers, including ping-maxwell, are investigating adapter compatibility with BigInt IDs.
  • The issue remains unresolved and is pending further confirmation.

Next Steps

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3699825031 --> @dosubot[bot] commented on GitHub (Dec 30, 2025): Hi, @songispm. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary** - You reported issues with backend support for BigInt user IDs causing errors, sharing schema examples and error screenshots. - You use MySQL 8.0, Prisma, and hono.js, and shared a temporary workaround by overriding BigInt's toJSON method. - Contributor windily-cloud confirmed registration and login work with BigInt IDs, but updates fail due to SQL type mismatches, leading to using strings instead. - Maintainers, including ping-maxwell, are investigating adapter compatibility with BigInt IDs. - The issue remains unresolved and is pending further confirmation. **Next Steps** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8425