zod icon indicating copy to clipboard operation
zod copied to clipboard

v4: z.file() fails in edge runtime in next.js server action

Open lr0pb opened this issue 7 months ago • 1 comments

When parsing schemas with new z.file() in edge runtime in next.js server actions it throws TypeError: Cannot read properties of undefined (reading 'args') error

Repro: https://github.com/lr0pb/zod-file-server-action-repro Server actions parsing fails, while similar parsing in route handler also with edge runtime - works fine

lr0pb avatar Apr 11 '25 23:04 lr0pb

There's a fix in the latest beta. Upgrade and let me know how it goes. Not sure if it'll work in production or not...still seeing the warning. Zod is designed to fall back to a non-Dynamic Code Evaluation approach when eval isn't supportd.

colinhacks avatar Apr 12 '25 09:04 colinhacks