rvf
rvf copied to clipboard
[Bug]: File type doesn't work in validation for next-safe-action (Next Server Actions)
Which packages are impacted?
- [ ]
@rvf/react - [ ]
@rvf/react-router - [ ]
@rvf/zod - [ ]
@rvf/yup - [x]
zod-form-data
What version of these packages are you using?
- "zod-form-data": "^2.0.7",
- "next-safe-action": "^7.10.6",
- "next": "15.2.3",
Please provide a link to a minimal reproduction of the issue.
https://github.com/foopis23/zfd-server-action-file-validation
Steps to Reproduce the Bug or Issue
- Run Application
- Go to http://localhost:3000
- Select files to upload
- Hit submit button
- See validation errors
Expected behavior
I expected validation to pass when files were uploaded. They are coming in as an array of file instances so i don't know why its failing.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Arc
- Version: 135.0.7049.116 (Official Build) (arm64)
Additional context
The two important files are:
src/app/page.tsx
src/server-actions/submit.ts
I implemented a non working (using zfd) and working version of the server action. For the working version i just made a custom zod type that worked the way i expected zfd.file() to work.
Hi!
I cloned the repo, but everything appears to work fine as far as I can tell. What version of node are you using?