NEO
NEO16mo 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
Nick16mo ago
What doesn’t work? What errors/output?
NEO
NEO16mo 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
Nick16mo 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
NEO16mo 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
Nick16mo 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
NEO16mo ago
Turns out it was the package manager bun, installing the deps with pnpm worked fine
Nick
Nick16mo ago
It always seems to be bun
NEO
NEO16mo 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
Nick16mo 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 🙂
More Posts
Codemod to v10 is not modifying any fileHello 👋, I must be super dumb but running `pnpm dlx trpc-v10-migrate-codemod ` in my project isn't No overload matches this call when outputting unionsHello there 👋, I have this simple procedure (we're not fully migrated on v10 yet, using interop): [help] Uncaught (in promise) TRPCClientError: Property description must be an object: uAfter building on linux, I visit the site. And Chrome console shows this error. But if I build on myHow can I make tRPC+NextJs APIs faster? (db and functions region is already same)Hi, I have migrated my website backend (https://clubofcoders.com) from NestJs + Prisma + Cloud Run tSuperjson "undefined"When returning a list from the db with a ton of potential undefined fields, superjson just crams a tThrowing fastify errors when using fastify adapterHello, I'm using `fastifyTRPCPlugin` from `@trpc/server/adapters/fastify` and trying to throw errorsConfused about createProxySSGHelpersIf you can use this helper inside of `getServerSideProps` without having `ssr: true` what is the difHow to check if data is being prefetched?What is a method to check if ssg prefetching actually occurs? Through the network tab?How can I access ctx from inside of a procedure?``` const appRouter = t.router({ helloTab: t.procedure.input(z.object({ url: z.string().url() })).Async User Call in `createContext` (context.ts) or in `isAuthed` (in trpc.ts)Hi all! Should I be getting the user in all requests via createContext in the following async call `