tRPC

T

tRPC

Join the community to ask questions about tRPC and get answers from other members.

Join

Example on Website has no Output Types

In this example from the website https://trpc.io/docs/quickstart#try-it-out-for-yourself there is no output type nference. If i download it its the same. For example in the index.ts in the client users has no type.
const users = await trpc.user.list.query();
const users = await trpc.user.list.query();
...

TRPC Error does not say router path

Hello, I have a tRPC client that sometimes fails to call my procedures/queries. I have many of them and find difficult to track back the router path that failed. Am I missing something? In the stacktrace I only get this: TRPCClientError: Unexpected token 'A', "An error o"... is not valid JSON...

TRPC-Image

Hello, Someone know if there are some news about a way to pass an image in a TRPC mutation? I don't want to upload the image before and later send the url to the mutation, someone know how can i handle this stuff?...

Client receives 200 status when throwing TRPCError

Using pnpm, Next 14 app router and tRPC v11 mainly based on create-t3-turbo. If I have a query on the client and then throw, for example, a TRPCError with code UNAUTHORIZED, the client is getting back a 200 rather than a 401. ```ts const handler = async (req: Request) => {...

`useSuspenseQuery` with Remix causes weird "Failed to parse URL from /api" errors

I'm using tRPC with Remix (no loaders, just a client app) and as soon as I converted my codebase from useQuery to useSuspenseQuery I'm now getting "Failed to parse URL from /api". errors in my console and server. It seems as though the queries are being run on the server for some reason (where /api cannot be parsed because window.location is not available). Any ideas what's going on? Is this intended behaviour?...

Getting nitro adapter to work

I'm struggling to get my trpc procedures to work using the nitro adapter: https://github.com/michealroberts/trpc-nitro-adapter I followed the steps here to install nitro: npx giget@latest nitro nitro-app --install ...

TRPC Services!

Does trpc support or work with mobile applications such expo-react-native

unstable_httpBatchStreamLink with React Native (Expo)

Has anyone managed to make the unstable_httpBatchStreamLink work with React Native (using Expo)? I tried multiple solutions, but none of them worked. Here is what is says in the docs : ```...

SSR in Remix/React Router

Has someone managed by any chance to make tRPC SSR work in Remix/React Router?

Simplifying SSR (e.g. in Next.JS)

I'm just trying to figure out if I'm missing something or if somebody else already tries this but: Wouldn't it be theoretically possible, for SSR, to detect when a useQuery is being SSR (e.g. checking typeof window === 'undefined') and therefore await the fetch call automatically and then pass it to initialData to rehydrate on the client?...

Type mismatch with queryClient prop of @trpc/react-query

Getting the following type-check error: ``` src/providers/query-client.tsx:49:42 - error TS2322: Type 'import("/<...>/node_modules/@tanstack/query-core/build/modern/hydration-CLZ8NKV0", { with: { "resolution-mode": "import" } }).b' is not assignable to type 'import("/<...>/node_modules/@tanstack/query-core/build/modern/hydration-C0fOPJLA").b'. Property '#private' in type 'QueryClient' refers to a different member that cannot be accessed from within type 'QueryClient'. ...

Getting type error for AppRouter

Hey. I've set up trpc in my monorepo as per this repo: https://github.com/t3-oss/create-t3-turbo (other auth provider). I am running in to these two type errors on the AppRouter type and haven't been able to solve them: Type 'CreateRouterInner<RootConfig<{ ctx: { db: NeonHttpDatabase<typeof import("/Users/emilqvarfort/Desktop/Projects/moktiv/code/moktiv/packages/db/src/schema/index")> & { $client: NeonQueryFunction<boolean, boolean>; }; token: string; session: { ...; }; user: { ...; } | undefined; }; meta: object; errorShape: { ...; }; t...' does not satisfy the constraint 'Router<any, any>' The types of '_def._config.transformer' are incompatible between these types....
No description

Cloudflare worker subscriptions/websockets

Does anyone have any experience setting up CF Workers with TRPC supbscriptions, in a way where I can have both subscriptions and mutation/queries at the same time? Also without the use of durable objects.

Prevent client tsc from typechecking the server

Hello, I'm trying to use trpc as documented here, but as soon as I put import type { AppRouter } from "../../src/index.ts"; the tsc for the browser client tries to check the node server and throws errors like ```...

Skew protection Vercel TRPC

Was wondering if I can enable vercel skew protection for trpc. According to docs, adding the dpl query should enable it. ```ts...

Infer TRoot and TProcedure for specific procedures (polymorphism)

Hello! I'm trying to build a custom hook that returns specific procedures of a router: ```tsx "use client"...

use cases

Hey, I only recently got to know trpc in connection with create-t3-app. Now I have the question, can I use it everywhere or is it only possible in connection with web frameworks? Would be very nice if you could enlighten me a bit 🙂...

Why Trpc duplicates `shape` and `data` as duplicated JSON field on errors in `errorFormatter`?

I am using error formater and internally TRPC duplicates the data information in the JSON response. Please see the screenshot
No description
Next