Skip to content

onServerValidate doesn't work with Zod in NextJs #1609

@heinsenberg82

Description

@heinsenberg82

Describe the bug

onServerValidate doesn't seem to work properly with Zod schemas.
Instead of populating the form with error messages, the form is receiving entire objects. Here's a link that reproduces the issue: https://stackblitz.com/edit/tanstack-form-3wvkfapn?file=src%2Fapp%2Faction.ts

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-3wvkfapn?file=src%2Fapp%2Faction.ts

Steps to reproduce

Go to link to reproduce the issue. Try to enter a number like '9'.

Expected behavior

Form should be populated with error messages, not zod error objects.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

Windows 11

TanStack Form adapter

None

TanStack Form version

1.14.1

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions