[GH-ISSUE #8729] 1.5.5 APIError extension bug #19804

Open
opened 2026-04-15 19:09:13 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @einsteinsbrd on GitHub (Mar 22, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8729

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

The APIError class in @better-auth/core/error extends a const constructor from better-call/error (not a class), and TypeScript can't resolve inherited Error properties through that chain. Neither message, body, nor status are visible on the type despite existing at runtime.

to reproduce, do something like :

if (isAPIError(err)) {
        logger.warn({ category: 'security', emailHash: hashForLog(email), reason: err.message, status: err.status }, 'Login failure');

Current vs. Expected behavior

extend class not const and work

What version of Better Auth are you using?

1.5.5

System info

just trust me, i already reverted versions to 1.4.4

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

Backend, Client

Auth config (if applicable)

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

Additional context

No response

Originally created by @einsteinsbrd on GitHub (Mar 22, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8729 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce The APIError class in @better-auth/core/error extends a const constructor from better-call/error (not a class), and TypeScript can't resolve inherited Error properties through that chain. Neither message, body, nor status are visible on the type despite existing at runtime. to reproduce, do something like : ``` if (isAPIError(err)) { logger.warn({ category: 'security', emailHash: hashForLog(email), reason: err.message, status: err.status }, 'Login failure'); ``` ### Current vs. Expected behavior extend class not const and work ### What version of Better Auth are you using? 1.5.5 ### System info ```bash just trust me, i already reverted versions to 1.4.4 ``` ### Which area(s) are affected? (Select all that apply) Backend, Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, }); ``` ### Additional context _No response_
GiteaMirror added the corebug labels 2026-04-15 19:09:13 -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#19804