A simple example of using SSE and subscriptions
onComplete
, onData
, etc options in a plain subscription got removed and is only available in useSubscription()
? The types from v10 have it https://github.com/trpc/trpc/blob/3bc06d055d3b860d978e9c465bce56fdcf95b71f/packages/client/src/internals/TRPCUntypedClient.ts#L32
Thanks!...tRPC v11 FileLike
Exported variable 'router' has or is using name 'FileLike' from external module "/node_modules/@trpc/server/dist/unstable-core-do-not-import/http/contentTypeParsers" but cannot be named.
Node version: v20.17 using pnpm...Auth Headers in Singleton Pattern
access_token
is only accessible within React land.
Given this, what is the recommended method to include the access_token
in the tRPC headers? Can this be achieved using the Singleton Pattern, or is it necessary to use TRPCProvider
instead?...Use middleware on the router level
v11 types ProcedureBuilder & MiddlewareBuilder
@trpc/server
. With v11 you can only import them via unstable-core-do-not-import
.
I have some properties on a class that should hold a t.middleware
and a t.procedure
. What's the recommended way to type my Middleware
and Procedure
in v11?
```ts...tRPC Monorepo w/ Package Path Aliases
create-t3-turbo
but with path aliases in that API sub package. I see Julius has setup a great monorepo example, however I see in all the packages he is only using relative imports.
Is this possible?...Doubled subscriptions in React with useSubscription
NextJs trpcClient and merged router. But it is returning a html doc instead of json error.
trpcClient
and merged router,
in nextJs v15, app router.
When i implement trpc with api routes /api/v2/user/[user]/route.ts
and utils/trpc nexbacthlink /api/v2/user
. this code snippet is working fine.
...api/v2/[trpc]/route.ts
. It working now with this.getting type error in the code from https://trpc.io/docs/client/react/server-components

Type error when following guide TRPC React query: 'lazy' is declared here.
Type 'CreateRouterInner<RootConfig<{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { users: CreateRouterInner<...>; }>' does not satisfy the constraint 'Router<any, any>'.
Types of property '_def' are incompatible.
Property 'lazy' is missing in type 'RouterDef<RootConfig<{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { users: CreateRouterInner<...>; }, { ...; }>' but required in type '{ _config: RootConfig<any>; router: true; procedure?: undefined; procedures: any; record: any; lazy: Record<string, LazyLoader<AnyRouter>>; }'.
Type 'CreateRouterInner<RootConfig<{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { users: CreateRouterInner<...>; }>' does not satisfy the constraint 'Router<any, any>'.
Types of property '_def' are incompatible.
Property 'lazy' is missing in type 'RouterDef<RootConfig<{ ctx: object; meta: object; errorShape: DefaultErrorShape; transformer: DefaultDataTransformer; }>, { users: CreateRouterInner<...>; }, { ...; }>' but required in type '{ _config: RootConfig<any>; router: true; procedure?: undefined; procedures: any; record: any; lazy: Record<string, LazyLoader<AnyRouter>>; }'.

state change not triggering refetch
AppRouter nested routers/procedures are any when imported in monorepo
composite: true
in the api package as it was both used in web app for types and in api app.
What are the best practices for keeping TRPC and ts-server fast?
Weird data type when extending context in fetch adapter
tsconfig.worker.json
) references the following types:
```json
"types": [
"@cloudflare/workers-types/2023-07-01",
"./worker-configuration.d.ts",...FormData TRPCClientError
Private chat with TRPC
Router type = any in monorepo...
import type { AppRouter } from 'api'
) , the type of AppRouter is any
:/.
I've followed all the steps from the FAQ, but to no avail....Creating Service Layer in Next App Router
trpc/client.tsx
and trpc/server.tsx
, respectively). Since each of these has a unique way of interacting with the trpc endpoint, and the server.tsx
file is "server-only"
and cant be used in my client components, I'm not sure how I can go about making a service layer that is reused between client and server components.
My existing service layer handled the trpc call as well as other conversions to FE models, so I would really like to avoid duplicating this work from client and server components if possible. Does anyone know how I can achieve this?...Stream closed, but it returns the actual data
Cannot set headers after they are sent to the client