Hono tRPC Server body issue
I have been trying to get Cloudflare Workers, Hono and tRPC working for tens of hours now.
I am using the
@hono/trpc-server package which gives me middleware for trpc to run with hono. They even have an example with cloudflare workers and a d1 database, so I know it is possible to do what I am trying to do.
The problem I am having is that tRPC is not reading the body properly, or at all. Take this function as an example:
It never even gets to the mutation part at all because validation fails. Using errorFormatting with tRPC shows me that input is undefined when getting passed by postman, which is weird because I am definitely sending a title. It all worked before when I hadn't moved to Cloudflare Workers and before I was using the hono trpc-server package.
This is how I serve the app:
Here is some more context so you can understand my code a little better.
context.ts
How can I get tRPC to start recognizing the input? The context and database queries work as intended, it's just the input that is not working.0 Replies