New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TRPCError: Input parser must be a ZodObject #204
Comments
Please share the full error & procedure that is causing the error. |
---------------pages/api/[...trpc].ts-----------------
------------pages/api/openapi.json.ts------------
------------/pages/api/openapi.tsx------------
--------------/server/routers/_app.ts---------------
-------------/server/routers/user.ts---------------
|
Lol you've shared everything except the |
I have 2 routes, user and test. When i make request to to any route /api/* except api/trpc/ all the requests are going to test route. Here is the code for the test route
Below is my folder setup for TRPC and Next routes |
This - .input(z.object({ name: z.string() }).nullish())
+ .input(z.object({ name: z.string().nullish() })) |
Thanks @jlalmes |
Hi,
I am getting the following error: TRPCError: Input parser must be a ZodObject. I am following the nextjs example provided in trpc-openapi/src/examples. Getting the same error on all trpc-open api routes [...trpc] including the openapi.json route.
I have looked through all the previous issues and can't seem to figure out what I am doing wrong.
Please let me know if additional details are required.
Regards,
Dawood
Package.json:
{
"name": "next-boilerplate",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@tanstack/react-query": "^4.20.2",
"@trpc/client": "^10.5.0",
"@trpc/next": "^10.5.0",
"@trpc/react-query": "^10.5.0",
"@trpc/server": "^10.5.0",
"@types/styled-components-react-native": "^5.1.3",
"next": "12.1.6",
"nextjs-cors": "^2.1.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-is": "^18.2.0",
"styled-components": "^5.3.5",
"superjson": "^1.12.0",
"swagger-ui-react": "^4.15.5",
"trpc-openapi": "^1.0.0",
"zod": "^3.20.2"
},
"devDependencies": {
"@types/node": "17.0.36",
"@types/react": "18.0.9",
"@types/react-dom": "18.0.5",
"@types/styled-components": "^5.1.25",
"@types/swagger-ui-react": "^4.11.0",
"eslint": "8.16.0",
"eslint-config-next": "12.1.6",
"typescript": "4.7.2"
},
"resolutions": {
"styled-components": "^5"
}
}
The text was updated successfully, but these errors were encountered: