Skip to content

Zod models are undefined on runtime for client components #861

@eelior

Description

@eelior

Description and expected behavior
After following the instructions in the Form Validation blog post, I attempted to use the generated zod models. They seemed to be working correctly at first, but then I encountered a runtime error.

Screenshots
If applicable, add screenshots to help explain your problem.

image

(alias) const ClientCreateSchema: z.ZodObject<{
    id: z.ZodOptional<z.ZodString>;
    createdAt: z.ZodOptional<z.ZodDate>;
    updatedAt: z.ZodOptional<z.ZodDate>;
    email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
    phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
    firstName: z.ZodString;
    lastName: z.ZodString;
}, "strip", z.ZodTypeAny, {
    firstName: string;
    lastName: string;
    id?: string | undefined;
    createdAt?: Date | undefined;
    updatedAt?: Date | undefined;
    email?: string | null | undefined;
    phone?: string | null | undefined;
}, {
    firstName: string;
    lastName: string;
    ... 4 more ...;
    phone?: string | null | undefined;
}>
image
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'ClientCreateSchema')

Environment:

  • ZenStack version: 1.1.1
  • Prisma version: 5.1.1
  • Database type: sqlite

Additional context
I have searched everywhere but couldn't find a similar issue. would greatly appreciate any help or direction in debugging it. 🙏🏽

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions