[GH-ISSUE #4787] Redis error after updating to 1.3.11 while calling auth.api.updateUser #27390

Closed
opened 2026-04-17 18:23:44 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @pauksztello on GitHub (Sep 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4787

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Install better auth 1.3.12 and above and call await auth.api.updateUser({
headers: await headers(),
body: { name },
});

Current vs. Expected behavior

After updating to better-auth 1.3.12 I started getting a Redis error when calling await auth.api.updateUser({
headers: await headers(),
body: { name },
});

Error: ERR value is not an integer or out of range
[0]     at #decodeSimpleError (../../../lib/RESP/decoder.ts:650:7)
[0]     at #decodeTypeValue (../../../lib/RESP/decoder.ts:171:34)
[0]     at Decoder.write (../../../lib/RESP/decoder.ts:90:32)
[0]     at RedisSocket.<anonymous> (../../../lib/client/index.ts:719:31)
[0]     at Socket.<anonymous> (../../../lib/client/socket.ts:275:32)

What version of Better Auth are you using?

1.3.12 and above

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020",
    "release": "24.6.0",
    "cpuCount": 10,
    "cpuModel": "Apple M2 Pro",
    "totalMemory": "16.00 GB",
    "freeMemory": "0.19 GB"
  },
  "node": {
    "version": "v23.10.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.2.0"
  },
  "frameworks": [
    {
      "name": "next",
      "version": "^15.5.3"
    },
    {
      "name": "react",
      "version": "^19.1.1"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "^8.16.3"
    },
    {
      "name": "drizzle",
      "version": "^0.44.5"
    },
    {
      "name": "@neondatabase/serverless",
      "version": "^1.0.1"
    }
  ],
  "betterAuth": {
    "version": "^1.3.13",
    "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 @pauksztello on GitHub (Sep 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4787 ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce Install better auth 1.3.12 and above and call await auth.api.updateUser({ headers: await headers(), body: { name }, }); ### Current vs. Expected behavior After updating to better-auth 1.3.12 I started getting a Redis error when calling await auth.api.updateUser({ headers: await headers(), body: { name }, }); ``` Error: ERR value is not an integer or out of range [0] at #decodeSimpleError (../../../lib/RESP/decoder.ts:650:7) [0] at #decodeTypeValue (../../../lib/RESP/decoder.ts:171:34) [0] at Decoder.write (../../../lib/RESP/decoder.ts:90:32) [0] at RedisSocket.<anonymous> (../../../lib/client/index.ts:719:31) [0] at Socket.<anonymous> (../../../lib/client/socket.ts:275:32) ``` ### What version of Better Auth are you using? 1.3.12 and above ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020", "release": "24.6.0", "cpuCount": 10, "cpuModel": "Apple M2 Pro", "totalMemory": "16.00 GB", "freeMemory": "0.19 GB" }, "node": { "version": "v23.10.0", "env": "development" }, "packageManager": { "name": "npm", "version": "11.2.0" }, "frameworks": [ { "name": "next", "version": "^15.5.3" }, { "name": "react", "version": "^19.1.1" } ], "databases": [ { "name": "pg", "version": "^8.16.3" }, { "name": "drizzle", "version": "^0.44.5" }, { "name": "@neondatabase/serverless", "version": "^1.0.1" } ], "betterAuth": { "version": "^1.3.13", "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-17 18:23:44 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 20, 2025):

Hi @pauksztello! I'm Dosu and I’m helping the better-auth team.

This Redis error is a known bug in better-auth versions 1.3.12 and 1.3.13. The root cause is a non-integer TTL value being passed to Redis when updating user sessions, which triggers the "ERR value is not an integer or out of range" error. This was fixed in a patch merged after 2025-09-19 by ensuring TTL values are always rounded down to integers using Math.floor before passing them to Redis PR #4768.

To resolve this, upgrade to the latest version of better-auth that includes this fix. If you can't upgrade right away, you can patch your local secondaryStorage implementation to ensure TTL values passed to Redis are always integers (for example, wrap the TTL calculation in Math.floor).

Let me know if you need help with the upgrade or patch!

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:3314989627 --> @dosubot[bot] commented on GitHub (Sep 20, 2025): <!-- Greeting --> Hi @pauksztello! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This Redis error is a known bug in better-auth versions 1.3.12 and 1.3.13. The root cause is a non-integer TTL value being passed to Redis when updating user sessions, which triggers the "ERR value is not an integer or out of range" error. This was fixed in a patch merged after 2025-09-19 by ensuring TTL values are always rounded down to integers using `Math.floor` before passing them to Redis [`PR #4768`](https://github.com/better-auth/better-auth/pull/4768). To resolve this, upgrade to the latest version of better-auth that includes this fix. If you can't upgrade right away, you can patch your local secondaryStorage implementation to ensure TTL values passed to Redis are always integers (for example, wrap the TTL calculation in `Math.floor`). Let me know if you need help with the upgrade or patch! <!-- 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/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6fc935a4-e780-4d2f-a068-c443d9bd7143?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/4787)
Author
Owner

@pauksztello commented on GitHub (Sep 23, 2025):

Fixed in 1.3.14

<!-- gh-comment-id:3324480933 --> @pauksztello commented on GitHub (Sep 23, 2025): Fixed in 1.3.14
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#27390