const EventResultResolveWireSchema = z.object({
event: EventSchema.optional(),
run: WorkflowRunSchema.optional(),
step: StepWireSchema.optional(),
hook: HookSchema.optional(),
events: z.array(EventSchema).optional(),
});
For some events, including run_started, Workflow validates the response from Vercel using WorkflowRunSchema. That schema is here:
export const WorkflowRunSchema = z.discriminatedUnion('status', [
WorkflowRunBaseSchema.extend({
status: z.enum(['pending', 'running']),
output: z.undefined(),
error: z.undefined(),
completedAt: z.undefined(),
}),
...
]);
That means: when a run is pending or running, Workflow expects output, error, and completedAt to be undefined.
But with your top-level zod@4.4.2, Zod is treating these missing fields as required/nonoptional, so when Vercel returns a running run like:
{
status: "running",
// no output
// no error
// no completedAt
}
Zod throws:
run.output: expected nonoptional, received undefined
run.error: expected nonoptional, received undefined
run.completedAt: expected nonoptional, received undefined
Sharing what i believe could be the cause of this issue -
I have added this comment on a Zod issue as well -> colinhacks/zod#5917 (comment)
Using workflow 5.0.0-beta-4