[GH-ISSUE #4856] 1.3.10 and later does not work on zod 3 projects (part 2) #10090

Closed
opened 2026-04-13 06:00:28 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jippi on GitHub (Sep 23, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4856

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

A couple of missed v3 compat changes from #4837

  • z.email() should be z.string().email()
  • z.record().....meta() should be z.record()....describe()

Tested using v1.3.15 that contained first round of fixes

Current vs. Expected behavior

Compile using zod v3

What version of Better Auth are you using?

v1.3.15

System info

N/A

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

Package

Auth config (if applicable)

N/A

Additional context

See https://github.com/better-auth/better-auth/issues/4837#issuecomment-3325586606

Originally created by @jippi on GitHub (Sep 23, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4856 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce A couple of missed v3 compat changes from #4837 * `z.email()` should be `z.string().email()` * `z.record().....meta()` should be `z.record()....describe()` Tested using `v1.3.15` that contained first round of fixes ### Current vs. Expected behavior Compile using zod v3 ### What version of Better Auth are you using? v1.3.15 ### System info ```bash N/A ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript N/A ``` ### Additional context See https://github.com/better-auth/better-auth/issues/4837#issuecomment-3325586606
GiteaMirror added the lockedbug labels 2026-04-13 06:00:28 -05:00
Author
Owner

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

Better Auth v1.3.15 and later do not support Zod v3. The codebase now uses Zod 4 features, such as .meta() on coerced types, which are not available in Zod v3 and will cause errors like TypeError: z.coerce.boolean(...).meta is not a function if you try to use Zod v3 with these versions details.

A recent migration #4851 updated all schemas to use .describe() instead of .meta() and corrected usages like z.email() to z.string().email(), directly addressing the missed v3 compat changes. However, as of PR #4345, Better Auth now requires Zod v4.1.5 or higher and no longer supports Zod v3.

To resolve these issues, upgrade your project and dependencies to Zod v4. If you have custom schemas using .meta(), update them to use .describe() instead. There are no workarounds for keeping Zod v3 with Better Auth v1.3.10 or later see migration notes.

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:3325639628 --> @dosubot[bot] commented on GitHub (Sep 23, 2025): <!-- Answer --> Better Auth v1.3.15 and later do not support Zod v3. The codebase now uses Zod 4 features, such as `.meta()` on coerced types, which are not available in Zod v3 and will cause errors like `TypeError: z.coerce.boolean(...).meta is not a function` if you try to use Zod v3 with these versions [details](https://github.com/better-auth/better-auth/issues/4837). A recent migration [#4851](https://github.com/better-auth/better-auth/pull/4851) updated all schemas to use `.describe()` instead of `.meta()` and corrected usages like `z.email()` to `z.string().email()`, directly addressing the missed v3 compat changes. However, as of PR [#4345](https://github.com/better-auth/better-auth/pull/4345), Better Auth now requires Zod v4.1.5 or higher and no longer supports Zod v3. To resolve these issues, upgrade your project and dependencies to Zod v4. If you have custom schemas using `.meta()`, update them to use `.describe()` instead. There are no workarounds for keeping Zod v3 with Better Auth v1.3.10 or later [see migration notes](https://github.com/better-auth/better-auth/pull/4345). <!-- 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/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ad4cc2c0-155f-426f-a000-f841164a1ca7?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/4856)
Author
Owner

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

@himself65 not sure where its coming from, but still seeing this one

node_modules/better-auth/dist/shared/better-auth.BxGZb2-I.mjs:      email: z.email().describe(
node_modules/better-auth/dist/shared/better-auth.BxGZb2-I.mjs:      newEmail: z.email().describe("The new email address to set must be a valid email address"),

after running npm i better-auth@1.3.16 in my project 🤔

<!-- gh-comment-id:3325830004 --> @jippi commented on GitHub (Sep 23, 2025): @himself65 not sure where its coming from, but still seeing this one ``` node_modules/better-auth/dist/shared/better-auth.BxGZb2-I.mjs: email: z.email().describe( node_modules/better-auth/dist/shared/better-auth.BxGZb2-I.mjs: newEmail: z.email().describe("The new email address to set must be a valid email address"), ``` after running `npm i better-auth@1.3.16` in my project 🤔
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10090