There are type errors #1049

Closed
opened 2026-03-13 08:20:28 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @Muhamed-Ragab on GitHub (Apr 15, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

better-auth functions don't detect changes in additionalFields

Current vs. Expected behavior

Image

Image

What version of Better Auth are you using?

1.2.7

Provide environment information

- OS: Windows 11 pro Version 23H2 (OS Build 22631.5189)
- Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

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

Types

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { nextCookies } from "better-auth/next-js";
import { admin, genericOAuth, openAPI, username } from "better-auth/plugins";

import {
  databaseHooksOptions,
  emailAndPasswordOptions,
  redisStorage,
  sessionOptions,
  socialProvidersOptions,
  userOptions,
} from "@/core/auth/options/better-auth";
import { companyEmailOptions } from "@/core/auth/options/company-email";
import { genericOAuthOptions } from "@/core/auth/options/generic-oauth";
import { validatorOptions } from "@/core/auth/options/validator";
import { companyEmail } from "@/core/auth/plugins/company-email";
import { validator } from "@/core/auth/plugins/validator";
import { db } from "@/core/db";
import * as schema from "@/core/db/schema";
import { randomUUID } from "node:crypto";

export const auth = betterAuth({
  appName: "Frontline",
  database: drizzleAdapter(db, {
    provider: "pg",
    schema,
  }),
  advanced: {
    generateId: () => randomUUID(),
  },
  emailAndPassword: emailAndPasswordOptions,
  user: userOptions,
  session: sessionOptions,
  secondaryStorage: redisStorage,
  socialProviders: socialProvidersOptions,
  databaseHooks: databaseHooksOptions,
  plugins: [
    admin(),
    username(),
    validator(validatorOptions),
    companyEmail(companyEmailOptions),
    openAPI(),
    genericOAuth(genericOAuthOptions),
    nextCookies(), // must be last
  ],
});


// options
export const userOptions: BetterAuthOptions["user"] = {
  additionalFields: {
    bio: { type: "string", required: false },
    companyName: { type: "string", required: true },
    companyLogo: { type: "string", required: false },
  },
};

Additional context

No response

Originally created by @Muhamed-Ragab on GitHub (Apr 15, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce better-auth functions don't detect changes in additionalFields ### Current vs. Expected behavior ![Image](https://github.com/user-attachments/assets/f18ed139-262d-43aa-8ffb-12fd0520a826) ![Image](https://github.com/user-attachments/assets/968e0fd0-6cfe-4532-928a-e9bd8918c026) ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - OS: Windows 11 pro Version 23H2 (OS Build 22631.5189) - Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 ``` ### Which area(s) are affected? (Select all that apply) Types ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { drizzleAdapter } from "better-auth/adapters/drizzle"; import { nextCookies } from "better-auth/next-js"; import { admin, genericOAuth, openAPI, username } from "better-auth/plugins"; import { databaseHooksOptions, emailAndPasswordOptions, redisStorage, sessionOptions, socialProvidersOptions, userOptions, } from "@/core/auth/options/better-auth"; import { companyEmailOptions } from "@/core/auth/options/company-email"; import { genericOAuthOptions } from "@/core/auth/options/generic-oauth"; import { validatorOptions } from "@/core/auth/options/validator"; import { companyEmail } from "@/core/auth/plugins/company-email"; import { validator } from "@/core/auth/plugins/validator"; import { db } from "@/core/db"; import * as schema from "@/core/db/schema"; import { randomUUID } from "node:crypto"; export const auth = betterAuth({ appName: "Frontline", database: drizzleAdapter(db, { provider: "pg", schema, }), advanced: { generateId: () => randomUUID(), }, emailAndPassword: emailAndPasswordOptions, user: userOptions, session: sessionOptions, secondaryStorage: redisStorage, socialProviders: socialProvidersOptions, databaseHooks: databaseHooksOptions, plugins: [ admin(), username(), validator(validatorOptions), companyEmail(companyEmailOptions), openAPI(), genericOAuth(genericOAuthOptions), nextCookies(), // must be last ], }); // options export const userOptions: BetterAuthOptions["user"] = { additionalFields: { bio: { type: "string", required: false }, companyName: { type: "string", required: true }, companyLogo: { type: "string", required: false }, }, }; ``` ### Additional context _No response_
GiteaMirror added the stalebug labels 2026-03-13 08:20:28 -05:00
Author
Owner

@devchaudhary24k commented on GitHub (Apr 15, 2025):

Temporary Solution: Revert to version 1.2.5, any version above 1.2.5 have some type errors.

@devchaudhary24k commented on GitHub (Apr 15, 2025): Temporary Solution: Revert to version 1.2.5, any version above 1.2.5 have some type errors.
Author
Owner

@rickvht commented on GitHub (Apr 15, 2025):

I'm using version 1.2.5 and I'm facing the same issue.

@rickvht commented on GitHub (Apr 15, 2025): I'm using version 1.2.5 and I'm facing the same issue.
Author
Owner

@Bekacru commented on GitHub (Apr 15, 2025):

can you guys confirm me if you're still facing issues on1.2.8-beta.1

@Bekacru commented on GitHub (Apr 15, 2025): can you guys confirm me if you're still facing issues on`1.2.8-beta.1`
Author
Owner

@Muhamed-Ragab commented on GitHub (Apr 17, 2025):

can you guys confirm me if you're still facing issues on1.2.8-beta.1

I have same issue

@Muhamed-Ragab commented on GitHub (Apr 17, 2025): > can you guys confirm me if you're still facing issues on`1.2.8-beta.1` I have same issue
Author
Owner

@rickvht commented on GitHub (Apr 17, 2025):

can you guys confirm me if you're still facing issues on1.2.8-beta.1

I'm sorry, my bad, I forgot to rtfm. For me it happened on the client-side and I forgot to add inferAdditionalFields() to my client plugins.

@rickvht commented on GitHub (Apr 17, 2025): > can you guys confirm me if you're still facing issues on`1.2.8-beta.1` I'm sorry, my bad, I forgot to rtfm. For me it happened on the client-side and I forgot to add inferAdditionalFields<typeof auth>() to my client plugins.
Author
Owner

@dosubot[bot] commented on GitHub (Jul 23, 2025):

Hi, @Muhamed-Ragab. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • Type error with additionalFields reported in version 1.2.7 on Windows 11 Pro using a Chrome-based browser.
  • Suggested temporary solution was to revert to version 1.2.5, but the issue persisted.
  • Issue confirmed to persist in version 1.2.8-beta.1.
  • Rickvht identified a client-side oversight, resolving the issue by adding inferAdditionalFields<typeof auth>() to client plugins.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository. If so, you can keep the discussion open by commenting here.
  • Otherwise, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jul 23, 2025): Hi, @Muhamed-Ragab. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary** - Type error with `additionalFields` reported in version 1.2.7 on Windows 11 Pro using a Chrome-based browser. - Suggested temporary solution was to revert to version 1.2.5, but the issue persisted. - Issue confirmed to persist in version `1.2.8-beta.1`. - Rickvht identified a client-side oversight, resolving the issue by adding `inferAdditionalFields<typeof auth>()` to client plugins. **Next Steps** - Please confirm if this issue is still relevant to the latest version of the better-auth repository. If so, you can keep the discussion open by commenting here. - Otherwise, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1049