rateLimit.lastRequest generates as Int instead of BigInt #564

Closed
opened 2026-03-13 07:53:10 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @ammarmbe on GitHub (Jan 15, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. create a Next.js app using npx create-next-app@latest
  2. install better-auth, prisma using npm install better-auth prisma
  3. initiate prisma using npx prisma init
  4. add the below auth config to auth.ts
  5. run npx @better-auth/cli@latest generate

Current vs. Expected behavior

the rateLimit.lastRequest field should be a BigInt instead of Int, this causes errors as the package tries to save times in unix milliseconds, which are bigger than the Int data type in PostgreSQL and MySQL.

What version of Better Auth are you using?

1.1.11

Provide environment information

- OS: Windows 11 build 22631.4602
- Browser: Chrome v131.0.6778.265
- Runtime: Node.js v20.18.0

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

Other

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: "postgresql",
  }),
  rateLimit: {
    enabled: true,
    storage: "database",
  },
});

Additional context

No response

Originally created by @ammarmbe on GitHub (Jan 15, 2025). ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce 1. create a Next.js app using `npx create-next-app@latest` 2. install better-auth, prisma using `npm install better-auth prisma` 3. initiate prisma using `npx prisma init` 4. add the below auth config to `auth.ts` 5. run `npx @better-auth/cli@latest generate` ### Current vs. Expected behavior the `rateLimit.lastRequest` field should be a `BigInt` instead of `Int`, this causes errors as the package tries to save times in unix milliseconds, which are bigger than the `Int` data type in PostgreSQL and MySQL. ### What version of Better Auth are you using? 1.1.11 ### Provide environment information ```bash - OS: Windows 11 build 22631.4602 - Browser: Chrome v131.0.6778.265 - Runtime: Node.js v20.18.0 ``` ### Which area(s) are affected? (Select all that apply) Other ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: "postgresql", }), rateLimit: { enabled: true, storage: "database", }, }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 07:53:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#564