operation input is formdata but trpc makes it an application/json POST call
operation:
request headers:
sample router
3 Replies
I found a fix to my issue:
superjson
transformer somewhat did not work in nextjs v15 app router, though it worked on v14 pages router
working code:
Shoutout to this repo, that I found my solution
https://github.com/juliangra/trpc-next-formdata-app-routerGitHub
GitHub - juliangra/trpc-next-formdata-app-router: Submit FormData w...
Submit FormData with tRPC 11 using Next.js App router - juliangra/trpc-next-formdata-app-router
Are you set up with that content type as documented here? https://trpc.io/docs/server/validators#non-json-content-types
Input & Output Validators | tRPC
tRPC procedures may define validation logic for their input and/or output, and validators are also used to infer the types of inputs and outputs. We have first class support for many popular validators, and you can integrate validators which we don't directly support.
Should work natively with most links (though tell us what link setup you're using as some may not support it)