NilsBN
tRPC9mo ago
3 replies
NilsB

Error trying to serve TRPC from custom path in Hono

I'm successfully serving a basic "hello world" using the default root path:

proxyApp.use("/trpc/*",
  trpcServer({
    router: appRouter,
  })
)


I can see the Hello World greeting I defined when I run curl http://localhost:3000/trpc/getGreeting

However, if I make a trivial change to the URL, like serving it from "/trpc2/*", trpc fails with a not-found error with a weird mangled path:
{"error":{"message":"No procedure found on path \"2/getGreeting\"","code":-32004,"data":{"code":"NOT_FOUND","httpStatus":404, ... }}}

(notice the first four characters missing on the path in the error message)

I'm using Hono and the new tanstack-query-trpc integration.

Am I missing something? Why is the path mangled in the error message?
Was this page helpful?