[GH-ISSUE #1958] nullish value on ratelimit key filed #17614

Closed
opened 2026-04-15 15:47:50 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @NimaCodez on GitHub (Mar 23, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1958

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Just configure a rate limit on a route (or all routes) and use database as your storage.

Current vs. Expected behavior

What version of Better Auth are you using?

1.2.4

Provide environment information

- OS [Windows 11]
- Browser: [Chrome]
- API Client: [Better Auth's Scala]

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

Package

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { Pool } from "pg";
import { openAPI, phoneNumber } from "better-auth/plugins";

export const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
  },
  rateLimit: {
    storage: "database",
    window: parseInt(Bun.env.RATE_LIMIT_TIME_WINDOW ?? "60"),
    max: parseInt(Bun.env.MAX_TRIES ?? "1"),
    enabled: true,
  },
 database: new Pool({
    connectionString: Bun.env.POSTGRES_STRING,
  }),
plugins: [
    openAPI(),
    phoneNumber({
      sendOTP({ phoneNumber, code }, request) {
        console.log(`Sending code: ${code} to phone number: ${phoneNumber}`);
      },

      signUpOnVerification: {
        getTempEmail: (phoneNumber) => {
          return `${phoneNumber}@example.com`;
        },
        //optionally, you can also pass `getTempName` function to generate a temporary name for the user
        getTempName: (phoneNumber) => {
          return phoneNumber; //by default, it will use the phone number as the name
        },
      },
    }),
  ]
)}

Additional context

Hi, I hope you're having some fun time (like us using better-auth)!
I wanted to mention that there's some nullish value on ratelimit key field when the storage is set to database (haven't tested the custom-storage).

here's the photo:

Image

Originally created by @NimaCodez on GitHub (Mar 23, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1958 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Just configure a rate limit on a route (or all routes) and use database as your storage. ### Current vs. Expected behavior - ### What version of Better Auth are you using? 1.2.4 ### Provide environment information ```bash - OS [Windows 11] - Browser: [Chrome] - API Client: [Better Auth's Scala] ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { Pool } from "pg"; import { openAPI, phoneNumber } from "better-auth/plugins"; export const auth = betterAuth({ emailAndPassword: { enabled: true, }, rateLimit: { storage: "database", window: parseInt(Bun.env.RATE_LIMIT_TIME_WINDOW ?? "60"), max: parseInt(Bun.env.MAX_TRIES ?? "1"), enabled: true, }, database: new Pool({ connectionString: Bun.env.POSTGRES_STRING, }), plugins: [ openAPI(), phoneNumber({ sendOTP({ phoneNumber, code }, request) { console.log(`Sending code: ${code} to phone number: ${phoneNumber}`); }, signUpOnVerification: { getTempEmail: (phoneNumber) => { return `${phoneNumber}@example.com`; }, //optionally, you can also pass `getTempName` function to generate a temporary name for the user getTempName: (phoneNumber) => { return phoneNumber; //by default, it will use the phone number as the name }, }, }), ] )} ``` ### Additional context Hi, I hope you're having some fun time (like us using better-auth)! I wanted to mention that there's some nullish value on ratelimit key field when the storage is set to database (haven't tested the custom-storage). here's the photo: ![Image](https://github.com/user-attachments/assets/e3fa4610-1634-4b6b-9485-aa2a5a7a3150)
GiteaMirror added the lockedbug labels 2026-04-15 15:47:50 -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#17614