[GH-ISSUE #5070] 1.3.25 - Issue with Ratelimit in dev #10156

Closed
opened 2026-04-13 06:06:43 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @elvince on GitHub (Oct 3, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5070

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

On the sign-up function in development we are now seeing: "Too many requests. Please try again later" during our E2E tests case where as in 1.3.24 there are no errors.
It was supposed to not be rate limit in dev.

Could you please look at this?

Current vs. Expected behavior

Call sign-up fct multiple times in parralel.

No issue in 1.3.24
Errors in 1.3.25

What version of Better Auth are you using?

1.3.25

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Pro",
    "release": "10.0.26100",
    "cpuCount": 16,
    "cpuModel": "Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz",
    "totalMemory": "31.72 GB",
    "freeMemory": "17.87 GB"
  },
  "node": {
    "version": "v22.14.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "10.9.2"
  },
  "frameworks": [
    {
      "name": "next",
      "version": "15.5.4"
    },
    {
      "name": "react",
      "version": "^19.1.1"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "8.16.3"
    },
    {
      "name": "@prisma/client",
      "version": "^6.16.3"
    }
  ],
  "betterAuth": {
    "version": "1.3.25",
    "config": null
  }
}

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

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
});

Additional context

No response

Originally created by @elvince on GitHub (Oct 3, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5070 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce On the sign-up function in development we are now seeing: "Too many requests. Please try again later" during our E2E tests case where as in 1.3.24 there are no errors. It was supposed to not be rate limit in dev. Could you please look at this? ### Current vs. Expected behavior Call sign-up fct multiple times in parralel. No issue in 1.3.24 Errors in 1.3.25 ### What version of Better Auth are you using? 1.3.25 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Pro", "release": "10.0.26100", "cpuCount": 16, "cpuModel": "Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz", "totalMemory": "31.72 GB", "freeMemory": "17.87 GB" }, "node": { "version": "v22.14.0", "env": "development" }, "packageManager": { "name": "npm", "version": "10.9.2" }, "frameworks": [ { "name": "next", "version": "15.5.4" }, { "name": "react", "version": "^19.1.1" } ], "databases": [ { "name": "pg", "version": "8.16.3" }, { "name": "@prisma/client", "version": "^6.16.3" } ], "betterAuth": { "version": "1.3.25", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 06:06:43 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 3, 2025):

This change is due to an update in 1.3.25: in development mode, Better Auth now always uses 127.0.0.1 as the client IP, which means rate limiting is consistently enforced in dev, whereas before it was often skipped because the IP was missing or invalid (details). By default, rate limiting should still be disabled in development unless you explicitly enable it, but if you see rate limiting in dev, double-check that your NODE_ENV is set to "development" during E2E runs and not "production" (source).

To guarantee rate limiting is off in dev and tests, explicitly set:

export const auth = betterAuth({
  emailAndPassword: { enabled: true },
  rateLimit: { enabled: false }
});

If you want to disable rate limiting only for specific routes (like sign-up), you can use a custom rule:

rateLimit: {
  customRules: {
    "/sign-up": false
  }
}

This will ensure your E2E tests are not blocked by rate limiting in development.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3366222402 --> @dosubot[bot] commented on GitHub (Oct 3, 2025): <!-- Answer --> This change is due to an update in 1.3.25: in development mode, Better Auth now always uses `127.0.0.1` as the client IP, which means rate limiting is consistently enforced in dev, whereas before it was often skipped because the IP was missing or invalid ([details](https://github.com/better-auth/better-auth/pull/2511)). By default, rate limiting should still be disabled in development unless you explicitly enable it, but if you see rate limiting in dev, double-check that your `NODE_ENV` is set to `"development"` during E2E runs and not `"production"` ([source](https://github.com/better-auth/better-auth/blob/a49e5acafbfa50397aae07b62f90a22e94509840/packages/better-auth/src/init.ts)). To guarantee rate limiting is off in dev and tests, explicitly set: ```js export const auth = betterAuth({ emailAndPassword: { enabled: true }, rateLimit: { enabled: false } }); ``` If you want to disable rate limiting only for specific routes (like sign-up), you can use a custom rule: ```js rateLimit: { customRules: { "/sign-up": false } } ``` This will ensure your E2E tests are not blocked by rate limiting in development. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3d924865-4386-4408-a5d7-3de59aadecf9?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/5070)
Author
Owner

@elvince commented on GitHub (Oct 3, 2025):

I checked that NODE_ENV is properly set to development.
So there is an issue somewhere.

<!-- gh-comment-id:3366246720 --> @elvince commented on GitHub (Oct 3, 2025): I checked that NODE_ENV is properly set to development. So there is an issue somewhere.
Author
Owner

@dosubot[bot] commented on GitHub (Oct 3, 2025):

In v1.3.25, Better Auth changed how it handles IPs in development: it now always uses 127.0.0.1 as the client IP, which means rate limiting will actually work in dev if it's enabled. However, by default, rate limiting should still be disabled in development unless you (or a plugin) explicitly set rateLimit: { enabled: true } in your config. The code and docs confirm this default behavior (source).

If you're seeing rate limiting in dev, it's likely that somewhere in your config (or a plugin) is setting rateLimit.enabled to true. To confirm, try explicitly setting:

export const auth = betterAuth({
  emailAndPassword: { enabled: true },
  rateLimit: { enabled: false }
});

If this disables rate limiting, then something was overriding the default. If not, try logging the resolved Better Auth config at runtime to see what value rateLimit.enabled actually has. Also, double-check for any plugins or shared config that might be enabling rate limiting.

If you only want to disable rate limiting for specific routes (like sign-up), you can use:

rateLimit: {
  customRules: {
    "/sign-up": false
  }
}

Let me know if setting rateLimit: { enabled: false } resolves it!

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3366256326 --> @dosubot[bot] commented on GitHub (Oct 3, 2025): <!-- Answer --> In v1.3.25, Better Auth changed how it handles IPs in development: it now always uses `127.0.0.1` as the client IP, which means rate limiting will actually work in dev if it's enabled. However, by default, rate limiting should still be disabled in development unless you (or a plugin) explicitly set `rateLimit: { enabled: true }` in your config. The code and docs confirm this default behavior ([source](https://github.com/better-auth/better-auth/blob/a49e5acafbfa50397aae07b62f90a22e94509840/packages/better-auth/src/init.ts)). If you're seeing rate limiting in dev, it's likely that somewhere in your config (or a plugin) is setting `rateLimit.enabled` to `true`. To confirm, try explicitly setting: ```js export const auth = betterAuth({ emailAndPassword: { enabled: true }, rateLimit: { enabled: false } }); ``` If this disables rate limiting, then something was overriding the default. If not, try logging the resolved Better Auth config at runtime to see what value `rateLimit.enabled` actually has. Also, double-check for any plugins or shared config that might be enabling rate limiting. If you only want to disable rate limiting for specific routes (like sign-up), you can use: ```js rateLimit: { customRules: { "/sign-up": false } } ``` Let me know if setting `rateLimit: { enabled: false }` resolves it! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/17275269-3dda-49e8-8573-a697564d0d6b?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/5070)
Author
Owner

@ping-maxwell commented on GitHub (Oct 6, 2025):

@elvince can you provide your auth config?

<!-- gh-comment-id:3370489503 --> @ping-maxwell commented on GitHub (Oct 6, 2025): @elvince can you provide your auth config?
Author
Owner

@elvince commented on GitHub (Oct 6, 2025):

@elvince can you provide your auth config?

Hi,
We made some additional investigation and learn that NextJs force the node_env to production when running with the "start command".
With the latest changes in Better Auth, we are now seeing the rate limit whereas it was not the case before.
We can close it as it is not a issue in Better Auth

<!-- gh-comment-id:3370609678 --> @elvince commented on GitHub (Oct 6, 2025): > [@elvince](https://github.com/elvince) can you provide your auth config? Hi, We made some additional investigation and learn that NextJs force the node_env to production when running with the "start command". With the latest changes in Better Auth, we are now seeing the rate limit whereas it was not the case before. We can close it as it is not a issue in Better Auth
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10156