Jack
Jack8mo ago

Type error when creating a server-side context 🤔

I am trying to set up my context for TRPC server, and I get the attached error. I am using TRPC v10, Node 20.7.0, TS 5.3.3 and Fastify for the API server. It seems the createHTTPHandler import is only suitable for vanilla HTTP module typings? Thanks for the help! 😄
No description
10 Replies
Jack
Jack8mo ago
This is my context definition:
No description
BeBoRE
BeBoRE8mo ago
You are trying to use CreateFastifyContextOptions where you should be using NodeHTTPCreateContextOptions
Jack
Jack8mo ago
Oh, thanks! Will that not cause any issues though? As I'm using fastify trpc adapter for my project?
Alex / KATT 🐱
you're importing the standalone adapter, not the fastify adapter
Jack
Jack8mo ago
I couldn't seem to find any fastify equivalent http function from the fastify adapter library
Jack
Jack8mo ago
No description
Jack
Jack8mo ago
I did try fastifyRequestHandler to no avail :( If you don't mind my jumping ahead, is fastify not 100% supported? Thanks for the help Alex!! I'll see if I can spin up a stackblitz repro
Jack
Jack8mo ago
Ah!! This might be me not looking further than my nose! 🤣 I'll try this out, many thanks
Jack
Jack8mo ago
Absolutely perfect! Everything works like a well oiled machine now!! Thanks so much
No description