T
tRPC

❓-help

WS with TRPC

Aacronie11/26/2023
│  Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3]
│ Types of parameters '__0' and 'opts' are incompatible.
│ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'.
│ Types of property 'req' are incompatible.
│ Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 26 more.
│  Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3]
│ Types of parameters '__0' and 'opts' are incompatible.
│ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'.
│ Types of property 'req' are incompatible.
│ Type 'IncomingMessage' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 26 more.
does anyone know how can I fix this and make it compatible with my opts?
Aacronie11/26/2023
I am using express adapter Also I have a doubt I just see yk a way to subscribe to updates? But not a way to emit an event from the client? is there some catch here
MDmarcos daniel11/26/2023
getting the same error, would like to know the answer as well
Aacronie11/27/2023
@marcos daniel have you figured out how you would emit events from the client? which go on as websocket event and not http request then emitting inside the mutation
MDmarcos daniel11/27/2023
I have no idea, im new to all this, but I dont know why you would want that, just send a plain http mutation

Looking for more? Join the community!

Recommended Posts
tRPC is butchering object types in return typesSo if I have a mutation that returns this type ```ts { name?: string } ``` the type that tRPC infersWhy my Authorization does not update ?i have this in `_app.tsx` ```export default function App({ Component, pageProps }: AppProps) { retTypeError: queryClient.getMutationDefaults is not a function (it is undefined)Hi! There's not much code to show here, as I'm really not sure where the error actually occurs. InuseQuery never returning or hitting APII have something off in my configuration, i copied most of the files from the `❯ npm create t3-app@lType 'QueryClient' is missing the following properties from type 'QueryClient': queryCache, mutationI am trying to setup a new project and doing my first client side query and getting this error: ```trpc mutation call stuckI have an issue with a simple mutation procedure: `getPublicUser: publicProcedure .input(z.objeCreate client based on OpenAPIHi! I am running a golang server with an openapi spec and would love to use trpc client in my fronteTRPC with react query, getting error twice?When i am try to show TRPC error in the client side with react-query, i am getting error twice from Error building create-t3-app: Page couldn't be rendered statically because it used `cookies`I get the following error when building create-t3-app: ``` TRPCClientError: Dynamic server usage: PaCompressing parts of query/mutation inputHi, I'm using trpc with the proxyclient for typesafety but recently hit an obstacle where some strin`useSuspenseQuery` still runs a fetch on SSR even when setting `ssr: false` in the api configBeside double-fetching, this causes issues during rendering if you have auth on your routes as the SUnsubscription callback triggering immediatelyHey! I am currently using Bun that's queried via a Vue application. For some reason the unsubscribeMultiple optimistic updates and old data from refetchesHi all, I'm new to tRPC and React Query and I'm just trying to get my head around what exactly I'm dPass headers when prefetching using helpersI dont see a way to pass headers and cookies with either fetch/prefetch methods from the ssr helper.I am getting a errors after starting a TRPC project with T3. "Unsafe return of an `any` typed value"It seems like something is off between Prisma and TRPC but I can't figure out why the type infrence Is there a similar handler to createNextApiHandler for fastify?I'm trying to create a global error handler in fatsify but I can't find anything. Is this even a thi