NEO
NEO2y ago

tRPC standalone server in monorepo

Hi, I'm using t3-stack monorepo as my base and I've swapped out NextJS backend for standalone HTTP server but I just can't get it work Discord wouldn't let me post the code as it was too long so I've uploaded the api.ts and client.ts along with the error to gist https://gist.github.com/neo773/7c8a314785d5e4f54c724cde7e5fa65c
Gist
tRPC standalone server in monorepo
tRPC standalone server in monorepo. GitHub Gist: instantly share code, notes, and snippets.
9 Replies
Nick
Nick2y ago
What doesn’t work? What errors/output?
NEO
NEOOP2y ago
Check the third file in gist for the error That’s what I get at this line
export const trpc = createTRPCReact<AppRouter>()
export const trpc = createTRPCReact<AppRouter>()
Nick
Nick2y ago
Oh are you running all the latest & exact same versions of tRPC dependencies? That's a new response code we added I think, it's important to keep versions in line
NEO
NEOOP2y ago
Yes, as I said before I’m using t3 stack monorepo template and the server and client have the same version of trpc
Nick
Nick2y ago
Maybe worth nuking the lock file just to be sure. I’m on the move now so can have another look over later, but it reads like a version mismatch
NEO
NEOOP2y ago
Turns out it was the package manager bun, installing the deps with pnpm worked fine
Nick
Nick2y ago
It always seems to be bun
NEO
NEOOP2y ago
They had a new update recently which added support for workspaces so I thought I'd give it a shot, anyway thanks for looking.
Nick
Nick2y ago
Yeah it's a really exciting project, just quite early days and many people have come in with strange issues later found to be Bun's fault Glad you sorted it 🙂