⨯ node_modules/.pnpm/zod-form-data@2.0.2_zod@3.23.8/node_modules/zod-form-data/dist/index.mjs (408:23) @ Object.file
⨯ ReferenceError: File is not defined
at Object.file (webpack-internal:///(rsc)/./node_modules/.pnpm/zod-form-data@2.0.2_zod@3.23.8/node_modules/zod-form-data/dist/index.mjs:419:68)
at eval (webpack-internal:///(rsc)/./app/api/route.ts:21:56)
at (rsc)/./app/api/route.ts (/Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:202:1)
at __webpack_require__ (/Users/xxxxxx/xxx/swift/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapi%2Froute&page=%2Fapi%2Froute&appPaths=&pagePath=private-next-app-dir%2Fapi%2Froute.ts&appDir=%2FUsers%2Fxxxxxx/xxx%2Fswift%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2FUsers%2Fxxxxxx/xxx%2Fswift&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!:15:114)
at (rsc)/./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapi%2Froute&page=%2Fapi%2Froute&appPaths=&pagePath=private-next-app-dir%2Fapi%2Froute.ts&appDir=%2FUsers%2Fxxxxxx/xxx%2Fswift%2Fapp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=%2FUsers%2Fxxxxxx/xxx%2Fswift&isDev=true&tsconfigPath=tsconfig.json&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D! (/Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:192:1)
at __webpack_require__ (/Users/xxxxxx/xxx/swift/.next/server/webpack-runtime.js:33:43)
at __webpack_exec__ (/Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:212:39)
at /Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:213:782
at __webpack_require__.X (/Users/xxxxxx/xxx/swift/.next/server/webpack-runtime.js:168:21)
at /Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:213:47
at Object.<anonymous> (/Users/xxxxxx/xxx/swift/.next/server/app/api/route.js:216:3)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at mod.require (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/cjs/helpers:110:18)
at requirePage (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/require.js:109:84)
at loadComponentsImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/load-components.js:98:57)
at async DevServer.findPageComponentsImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/next-server.js:708:36)
at async DevServer.findPageComponents (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/dev/next-dev-server.js:576:20)
at async DevServer.renderPageComponent (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/base-server.js:1964:24)
at async DevServer.renderToResponseImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/base-server.js:2016:32)
at async DevServer.pipeImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/base-server.js:908:25)
at async NextNodeServer.handleCatchallRenderRequest (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/next-server.js:273:17)
at async DevServer.handleRequestImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/base-server.js:804:17)
at async /Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/dev/next-dev-server.js:339:20
at async Span.traceAsyncFn (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/trace/trace.js:157:20)
at async DevServer.handleRequest (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/dev/next-dev-server.js:336:24)
at async invokeRender (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/lib/router-server.js:175:21)
at async handleRequest (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/lib/router-server.js:354:24)
at async requestHandlerImpl (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/lib/router-server.js:378:13)
at async Server.requestListener (/Users/xxxxxx/xxx/swift/node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/server/lib/start-server.js:142:13) {
page: '/api'
}
406 | z.literal(void 0).transform(() => false)
407 | ]);
> 408 | var file = (schema = z.instanceof(File)) => z.preprocess((val) => {
| ^
409 | return val instanceof File && val.size === 0 ? void 0 : val;
410 | }, schema);
411 | var repeatable = (schema = z.array(text())) => {
⚠ metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "http://localhost:3001". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase
GET / 200 in 479ms
○ Compiling /_error ...
✓ Compiled /_error in 691ms (934 modules)
Each child in a list should have a unique "key" prop.
Check the render method of Head. See https://react.dev/link/warning-keys for more information.
at meta
at head
at Head (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:308:1)
at html
at Html (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:789:132)
at Document (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:805:1)
POST /api 500 in 1347ms
### Expected behavior
The following code will succeed in `safeParse()` without error
### Screenshots or Videos
_No response_
### Platform
- OS: macOS
- Browser: Chrome,
- Version: 128.0.6613.139(Official Build) (arm64)
### Additional context
- This process is performed in the api route of the Next.js app router.
- If the `zfd.file()` was changed to `z.any()`, the process worked fine.
Which packages are impacted?
@rvf/react
@rvf/remix
@rvf/zod
@rvf/yup
zod-form-data
What version of these packages are you using?
"zod-form-data": "^2.0.2" "react": "19.0.0-rc-100dfd7dab-20240701", "react-dom": "19.0.0-rc-100dfd7dab-20240701", "next": "15.0.0-rc.0",
Please provide a link to a minimal reproduction of the issue.
https://github.com/ai-ng/swift
Steps to Reproduce the Bug or Issue
pnpm dev
.Check the render method of
Head
. See https://react.dev/link/warning-keys for more information. at meta at head at Head (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:308:1) at html at Html (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701__lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:789:132) at Document (webpack-internal:///./node_modules/.pnpm/next@15.0.0-rc.0_react-dom@19.0.0-rc-100dfd7dab-20240701_react@19.0.0-rc-100dfd7dab-20240701lvd5ix3jtkf3vgn4rdino54hua/node_modules/next/dist/pages/_document.js:805:1) POST /api 500 in 1347msconst schema = zfd.formData({ input: z.union([zfd.text(), zfd.file()]), message: zfd.repeatableOfType( zfd.json( z.object({ role: z.enum(["user", "assistant"]), content: z.string(), }) ) ),