}\n \u003C/Provider>\n {/* \u003C/TRPCProvider> */}\n \u003C/QueryClientProvider>\n );\n};\n\nexport default AppProvider;\n```\n\n**React Query**\n```typescript\nimport {\n defaultShouldDehydrateQuery,\n QueryClient,\n} from \"@tanstack/react-query\";\nimport SuperJSON from \"superjson\";\n\nexport const createQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n // With SSR, we usually want to set some default staleTime\n // above 0 to avoid refetching immediately on the client\n staleTime: 360 * 1000,\n },\n dehydrate: {\n serializeData: SuperJSON.serialize,\n shouldDehydrateQuery: (query) =>\n defaultShouldDehydrateQuery(query) ||\n query.state.status === \"pending\",\n },\n hydrate: {\n deserializeData: SuperJSON.deserialize,\n },\n },\n });\n````\n\n**Page.tsx**\n```typescript\n\"use client\";\nimport { api } from \"@c/Provider\";\n// import { useTRPC } from \"@c/Provider\";\nimport { useSession } from \"@hwa/client\";\n// import { useQuery } from \"@tanstack/react-query\";\nimport { useRouter } from \"next/navigation\";\n\nconst Home = () => {\n const router = useRouter();\n const session = useSession();\n // const trpc = useTRPC();\n // const { data } = useQuery(trpc.message.getMessage.queryOptions());\n const { data } = api.message.getMessage.useQuery(); // message is undefined\n return (\n \u003Cdiv className=\"\">\n \u003Cp>{data}\u003C/p>\n \u003Cpre\n style={{\n padding: \"10px\",\n fontFamily: \"monospace\",\n whiteSpace: \"pre-wrap\",\n }}\n >\n {JSON.stringify(session, null, 2)}\n \u003C/pre>\n \u003Cbutton\n className=\"rounded border px-6 py-1\"\n onClick={() => router.refresh()}\n >\n Refresh\n \u003C/button>\n \u003C/div>\n );\n};\n\nexport default Home;\n\n```\n\n### Link to reproduction\n\nhttps://github.com/SamJbori/hwaTurbo\n\n### To reproduce\n\nCreate a split BE and FE with Turbo Repo\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3172],{"name":3173,"color":3174},"🐛 bug: unconfirmed","e99695",6933,"trpc","open","bug: createTRPCReact return undefined routers on split FE/BE","2025-09-06T23:01:14Z","https://github.com/trpc/trpc/issues/6933",0.64124644,{"description":3183,"labels":3184,"number":3186,"owner":3176,"repository":3176,"state":3177,"title":3187,"updated_at":3188,"url":3189,"score":3190},"### Provide environment information\n\n System:\n OS: macOS 14.4\n CPU: (12) arm64 Apple M2 Pro\n Memory: 118.03 MB / 16.00 GB\n Shell: 5.9 - /bin/zsh\n Binaries:\n Node: 23.7.0 - ~/.nvm/versions/node/v23.7.0/bin/node\n Yarn: 1.22.22 - /opt/homebrew/bin/yarn\n npm: 10.9.2 - ~/.nvm/versions/node/v23.7.0/bin/npm\n bun: 0.5.9 - ~/.bun/bin/bun\n Watchman: 2025.02.17.00 - /opt/homebrew/bin/watchman\n Browsers:\n Chrome: 135.0.7049.114\n Safari: 17.4\n\n### Describe the bug\n\nSo I originally ran into this bug while working on an Expo project using the Effect.ts framework. I'll provide my original Effect code in case that's helpful, but I also reproduced something like it in the attached repo since Effect is relatively obscure.\n\n\nFor my Effect code:\n\n```ts\nexport class LoginClient extends Effect.Service\u003CLoginClient>()(\"LoginClient\", {\n effect: Effect.gen(function*() {\n console.log('1')\n const makeUrl = yield* APIUrlConstructor\n console.log('2', makeUrl)\n const url = makeUrl('login')\n console.log('url', url)\n console.log('createtrpclient', createTRPCClient)\n console.log('httpBatchLink', httpBatchLink)\n const client = createTRPCClient\u003CLoginRouter>({\n links: [\n httpBatchLink({\n url: url,\n }),\n ],\n })\n console.log('trpc client', client)\n return client\n }),\n dependencies: [APIUrlConstructor.Default]\n}) {}\n```\n\nWhen I ran this, everything up to the `const client = ...` would work fine. But, it would never console log the client. The logs for createTRPCClient and httpBatchLink would show that they are successfully imported as functions. This was a silent failure, but I think the silent part might be due to how Effect works. When I tried wrapping everything in a try catch block, I got an error saying that undefined is not a function. \n\nFor the attached repo:\n\nI have a basic Expo project with an express server. If you try to run it however, you'll get the same 'undefined is not a function' that's triggered by console logging the client on line 19 in client/client.ts. If you remove the console log however, it should work. \n\nIf you remove the console log in client.ts and try console logging the client in app/_layout.ts before the api call it should also throw there. \n\nI think these are coming from the same bug. \n\nLet me know if there's any additional details that would help. I can try reproducing outside of Expo if that helps as well.\n\n### Link to reproduction\n\nhttps://github.com/Brandon-Perry/trpcissue-undefined-function\n\n### To reproduce\n\nDownload the repo above, `npm i` in both subfolders, run `npm start` in both subfolders. On the expo client, choose ios. The error should immediately trigger.\n\nNote: you might need to install xCode to reproduce this. \n\n### Additional information\n\nFor contributing, I'm open to implementing a fix if I'm given some guidance on what might be causing it. \n\n### 👨👧👦 Contributing\n\n- [x] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3185],{"name":3173,"color":3174},6724,"bug: tRPC client is undefined","2025-04-27T22:24:43Z","https://github.com/trpc/trpc/issues/6724",0.6508652,{"description":3192,"labels":3193,"number":3195,"owner":3176,"repository":3176,"state":3177,"title":3196,"updated_at":3197,"url":3198,"score":3199},"### Provide environment information\n\n``` \nSystem:\n OS: macOS 14.5\n CPU: (12) arm64 Apple M2 Max\n Memory: 73.41 MB / 32.00 GB\n Shell: 5.9 - /bin/zsh\n Binaries:\n Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node\n Yarn: 1.22.22 - ~/Library/pnpm/yarn\n npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm\n Browsers:\n Chrome: 135.0.7049.117\n Edge: 134.0.3124.62\n Safari: 17.5\n npmPackages:\n @trpc/server: ^11.1.2 => 11.1.2 \n typescript: ^5.8.3 => 5.8.3 \n```\n\n### Describe the bug\n\nWhen using the documented pattern for defining a router (verbatim from https://trpc.io/docs/server/routers), TypeScript emits declaration files that include imports from `@trpc/server/dist/unstable-core-do-not-import`, which is not exposed via the package’s exports field.\n\nThis makes the generated `.d.ts` files invalid for consumers that rely on strict ESM resolution, including build tools and downstream libraries.\n\n### Link to reproduction\n\nhttps://github.com/extradosages/trpc-type-leak-demo\n\n### To reproduce\n\nUse the following `trpc.ts` and `router.ts` files (copied verbatim from the docs):\n\n`trcp.ts`\n```ts\nimport { initTRPC } from '@trpc/server';\nconst t = initTRPC.create();\nexport const router = t.router;\nexport const publicProcedure = t.procedure;\n```\n\n`router.ts`\n```ts\nimport { publicProcedure, router } from './trpc';\nconst appRouter = router({\n greeting: publicProcedure.query(() => 'hello tRPC v10!'),\n});\nexport type AppRouter = typeof appRouter;\n```\n\nRun:\n```bash\ntsc --emitDeclarationOnly\n```\n\nObserve that `router.d.ts` includes:\n```ts\ndeclare const appRouter: import(\"@trpc/server/dist/unstable-core-do-not-import\").BuiltRouter\u003C...>;\n```\n\nCompare to the `package.json` `exports` field:\n```json\n\"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n ...\n },\n ...\n \"./unstable-core-do-not-import\": {\n \"import\": \"./dist/unstable-core-do-not-import.mjs\",\n ...\n }\n}\n```\n\n### Additional information\n\nMight be solved by https://github.com/trpc/trpc/issues/5004.\n\nCurrently running a workaround in production with the following patch:\n```diff\ndiff --git a/package.json b/package.json\nindex 1f03d01bd1148bffc1434ac66f9feb52ba654bc3..f73cdbd446c2421a377af8ce0459288e1ee1162b 100644\n--- a/package.json\n+++ b/package.json\n@@ -73,6 +73,11 @@\n \"require\": \"./dist/adapters/ws.js\",\n \"default\": \"./dist/adapters/ws.js\"\n },\n+ \"./dist/*\": {\n+ \"import\": \"./dist/*\",\n+ \"require\": \"./dist/*\",\n+ \"default\": \"./dist/*\"\n+ },\n \"./http\": {\n \"import\": \"./dist/http.mjs\",\n \"require\": \"./dist/http.js\",\n```\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3194],{"name":3173,"color":3174},6753,"bug: generated `.d.ts` files leaking un-exported types","2025-05-07T23:42:57Z","https://github.com/trpc/trpc/issues/6753",0.6627633,{"description":3201,"labels":3202,"number":3203,"owner":3176,"repository":3176,"state":3204,"title":3205,"updated_at":3206,"url":3207,"score":3208},"### Provide environment information\r\n\r\n```\r\n\r\n System:\r\n OS: macOS 12.5.1\r\n CPU: (8) arm64 Apple M1\r\n Memory: 157.83 MB / 16.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node\r\n Yarn: 1.22.19 - /opt/homebrew/bin/yarn\r\n npm: 8.19.1 - ~/.nvm/versions/node/v16.17.0/bin/npm\r\n Watchman: 2022.09.12.00 - /opt/homebrew/bin/watchman\r\n Browsers:\r\n Brave Browser: 106.1.44.105\r\n Chrome: 105.0.5195.125\r\n Firefox: 105.0.1\r\n Safari: 16.0\r\n npmPackages:\r\n @trpc/react: ^10.0.0-proxy-beta.15 => 10.0.0-proxy-beta.15\r\n react: 18.0.0 => 18.0.0 \r\n typescript: ~4.7.4 => 4.7.4 \r\n\r\n```\r\n\r\n### Describe the bug\r\n\r\nIf I create a trpc react proxy and client like:\r\n\r\n```typescript\r\nexport const trpc = createTRPCReact\u003CUserRouter>()\r\nexport const trpcClient: TRPCClient\u003CUserRouter> = trpc.createClient({\r\n links: [\r\n httpBatchLink({\r\n url: \"http://localhost:3000/user\"\r\n }),\r\n ],\r\n})\r\n```\r\n\r\nAnd try to use the `trpcClient` directly, it does not have the correct types:\r\n\r\n```typescript\r\n const createAccountResult = await trpcClient.mutation(\"account.create\")\r\n```\r\n\r\nWill return: `TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.`\r\n\r\n### Link to reproduction\r\n\r\nhttps://stackblitz.com/github/trpc/examples-next-minimal-starter\r\n\r\n### To reproduce\r\n\r\nSee above\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [X] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[],2922,"closed","bug: `TRPCClient` from `createTRPCReact\u003CRouterType>().createClient` is incorrectly typed","2022-10-05T23:29:07Z","https://github.com/trpc/trpc/issues/2922",0.64621526,{"description":3210,"labels":3211,"number":3212,"owner":3176,"repository":3176,"state":3204,"title":3213,"updated_at":3214,"url":3215,"score":3216},"### Provide environment information\n\n```\r\n System:\r\n OS: macOS 12.5.1\r\n CPU: (8) x64 Apple M1 Pro\r\n Memory: 32.37 MB / 32.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node\r\n Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn\r\n npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm\r\n Browsers:\r\n Brave Browser: 105.1.43.89\r\n Chrome: 105.0.5195.102\r\n Firefox Developer Edition: 105.0\r\n Safari: 15.6.1\r\n npmPackages:\r\n @tanstack/react-query: 4.3.4 => 4.3.4 \r\n @trpc/client: 10.0.0-proxy-alpha.75 => 10.0.0-proxy-alpha.75 \r\n @trpc/next: 10.0.0-proxy-alpha.75 => 10.0.0-proxy-alpha.75 \r\n @trpc/react: 10.0.0-proxy-alpha.75 => 10.0.0-proxy-alpha.75 \r\n @trpc/server: 10.0.0-proxy-alpha.75 => 10.0.0-proxy-alpha.75 \r\n next: 12.3.0 => 12.3.0 \r\n react: 17.0.2 => 17.0.2 \r\n```\n\n### Describe the bug\n\nit seems the result type of `createTRPCNext` is not typed correctly. Have a look at the provided codesandbox + the comments.\r\n\r\nThere is no check that the returned object \"satisfies\" the type `WithTRPCConfig`\n\n### To reproduce\n\nhttps://codesandbox.io/s/createtrpcnext-typings-6hgbuh?file=/index.ts\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [X] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[],2693,"bug: createTRPCNext return types","2022-10-04T00:17:53Z","https://github.com/trpc/trpc/issues/2693",0.65503186,{"description":3218,"labels":3219,"number":3220,"owner":3176,"repository":3176,"state":3204,"title":3221,"updated_at":3222,"url":3223,"score":3224},"### Provide environment information\n\n```\r\n System:\r\n OS: macOS 12.6\r\n CPU: (10) x64 Apple M1 Max\r\n Memory: 95.50 MB / 32.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 14.19.3 - ~/.nvm/versions/node/v14.19.3/bin/node\r\n Yarn: 1.22.19 - /opt/homebrew/bin/yarn\r\n npm: 6.14.17 - ~/.nvm/versions/node/v14.19.3/bin/npm\r\n Browsers:\r\n Chrome: 108.0.5359.98\r\n Safari: 16.0\r\n npmPackages:\r\n @tanstack/react-query: ^4.16.0 => 4.19.1 \r\n @trpc/client: ^10.0.0 => 10.5.0 \r\n @trpc/next: ^10.0.0 => 10.5.0 \r\n @trpc/react-query: ^10.0.0 => 10.5.0 \r\n @trpc/server: ^10.0.0 => 10.5.0 \r\n next: 13.0.2 => 13.0.2 \r\n react: 18.2.0 => 18.2.0 \r\n typescript: ^4.8.4 => 4.9.4 \r\n\r\n```\n\n### Describe the bug\n\nI want to use a \"suspended\" query in combination with `next-auth`. \r\n\r\nFor this I created a `protectedProcedure` like this:\r\n\r\n```ts\r\nconst isAuthed = t.middleware(({ ctx, next }) => {\r\n if (!ctx.session || !ctx.session.user) {\r\n throw new TRPCError({ code: \"UNAUTHORIZED\" });\r\n }\r\n return next({\r\n ctx: {\r\n // infers the `session` as non-nullable\r\n session: { ...ctx.session, user: ctx.session.user },\r\n },\r\n });\r\n});\r\n\r\nexport const protectedProcedure = t.procedure.use(isAuthed);\r\n```\r\n\r\nand am using it in my router:\r\n\r\n```ts\r\ngetSecretMessage: protectedProcedure.query(() => {\r\n return \"you can now see this secret message!\";\r\n}),\r\n```\r\n\r\nMy expectation would be that this query gets authorized even with `{suspense: true}` which is unfortunately not the case. \r\nUsing it without suspense returns the correct data and I have a session in in my context.\r\n\r\n```ts\r\nconst { data: secretMessage } = trpc.auth.getSecretMessage.useQuery(\r\n undefined, // no input\r\n );\r\n```\r\n\r\nAs soon as I add the `suspense` flag it is not working anymore and the session is always null which results in an unauthorized error\r\n\r\n```ts\r\nconst { data: secretMessage } = trpc.auth.getSecretMessage.useQuery(\r\n undefined, // no input\r\n {suspense: true}\r\n );\r\n```\r\nIt is the same behaviour with `useSuspenseQuery`.\r\n\n\n### Link to reproduction\n\nhttps://github.com/engelkes-finstreet/next-auth-trpc-suspense\n\n### To reproduce\n\nUnfortunately I could not get the example running on Stackblitz / Codesandbox so I hope a link to my GitHub-Repository is enough as well.\r\n\r\nCheck out the repository and add any provider inside `pages/api/auth/[...nextauth].ts` and add these credentials to a `.env` file. You can copy the `.env.example` for it. Afterwards run `npx prisma migrate dev` and start the dev server with `npm run dev`. \r\nOn the index page is a `sign in` button which you can click and sign in with your given provider. After the redirect back to the index page try to refresh the page and you will see that the authorization error occurs. \r\nNow you can go ahead and remove the `{ suspense: true }` from the query and refresh the page. Now you will see the secret message.\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[],3386,"bug: ","2022-12-28T00:05:20Z","https://github.com/trpc/trpc/issues/3386",0.6552345,{"description":3226,"labels":3227,"number":3231,"owner":3176,"repository":3176,"state":3204,"title":3232,"updated_at":3233,"url":3234,"score":3235},"### Provide environment information\r\n\r\n System:\r\n OS: macOS 13.0\r\n CPU: (10) arm64 Apple M1 Max\r\n Memory: 4.32 GB / 64.00 GB\r\n Shell: 5.8.1 - /bin/zsh\r\n Binaries:\r\n Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node\r\n Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.1/bin/yarn\r\n npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm\r\n Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman\r\n Browsers:\r\n Chrome: 108.0.5359.71\r\n Firefox: 107.0\r\n Safari: 16.1\r\n npmPackages:\r\n @tanstack/react-query: ^4.18.0 => 4.18.0 \r\n @trpc/client: ^10.4.1 => 10.4.1 \r\n @trpc/react-query: ^10.4.1 => 10.4.1 \r\n @trpc/server: ^10.4.1 => 10.4.1 \r\n next: ^13.0.4 => 13.0.5 \r\n react: 18.1.0 => 18.1.0 \r\n typescript: ^4.6.3 => 4.9.3 \r\n\r\n\r\n### Describe the bug\r\n\r\n\r\nSo is my app.tsx\r\n\r\n```\r\nexport default function App() {\r\n return (\r\n \u003CAuthenticationProvider>\r\n \u003CTRPCProvider>\r\n \u003CThemeProvider theme={theme}>\r\n \u003CNavigationContainer>\r\n \u003CStack.Navigator>\r\n \u003CStack.Screen name=\"Criteria\" component={MovieSearchComponent}/>\r\n \u003CStack.Screen name=\"Results\" component={ResultsComponent}/>\r\n \u003C/Stack.Navigator>\r\n \u003C/NavigationContainer>\r\n \u003C/ThemeProvider>\r\n \u003C/TRPCProvider>\r\n \u003C/AuthenticationProvider>\r\n );\r\n}\r\n```\r\nmy component\r\n\r\n```\r\nimport { trpc } from \"../../utils/trpc-client\";\r\n\r\nexport function ResultsComponent({navigation, route}) {\r\n\r\n const {data} = trpc.moviesRecommendation.useQuery(\r\n {\r\n runtimeMinsMin: 100\r\n }\r\n )\r\n```\r\ntrpc-client.ts\r\n\r\n```\r\nimport { AppRouter } from \"../server/trpc\";\r\nimport { createTRPCReact, httpLink } from \"@trpc/react-query\";\r\n\r\nexport const trpc = createTRPCReact\u003CAppRouter>()\r\n\r\nexport const trpcClient = trpc.createClient({\r\n links: [httpLink({url: 'http://localhost:3000/api/trpc'})],\r\n})\r\n```\r\nand trpc-provider.ts\r\n\r\n```\r\nexport function TRPCProvider({children}: PropsWithChildren) {\r\n const [queryClient] = useState(() => new QueryClient())\r\n\r\n return (\r\n \u003Ctrpc.Provider client={trpcClient} queryClient={queryClient}>\r\n \u003CQueryClientProvider client={queryClient} contextSharing={true}>\r\n {children}\r\n \u003C/QueryClientProvider>\r\n \u003C/trpc.Provider>\r\n )\r\n}\r\n```\r\nSo is the web error while using useQuery:\r\n```\r\n\r\nUncaught Error: No QueryClient set, use QueryClientProvider to set one\r\n at Object.useQueryClient (QueryClientProvider.tsx:48:1)\r\n at Object.useBaseQuery (useBaseQuery.ts:33:1)\r\n at useQuery (useQuery.ts:139:1)\r\n at Object.useQuery$1 [as useQuery] (createHooksInternal-808efaa7.mjs:277:1)\r\n at createHooksInternal-808efaa7.mjs:52:1\r\n at Object.apply (index-972002da.mjs:18:1)\r\n at ResultsComponent (results-component.tsx:11:1)\r\n at renderWithHooks (react-dom.development.js:16175:1)\r\n at mountIndeterminateComponent (react-dom.development.js:20913:1)\r\n at beginWork (react-dom.development.js:22416:1)\r\n```\r\n\r\n\r\n\r\n",[3228],{"name":3229,"color":3230},"👻 invalid","e4e669",3316,"bug: Expo + trpc: Uncaught Error: No QueryClient set, use QueryClientProvider to set one","2022-12-20T12:02:19Z","https://github.com/trpc/trpc/issues/3316",0.6558566,{"description":3237,"labels":3238,"number":3239,"owner":3176,"repository":3176,"state":3204,"title":3240,"updated_at":3241,"url":3242,"score":3243},"### Provide environment information\r\n\r\n``` \r\nSystem:\r\n OS: macOS 12.2.1\r\n CPU: (10) arm64 Apple M1 Max\r\n Memory: 131.52 MB / 32.00 GB\r\n Shell: 3.2.57 - /bin/bash\r\n Binaries:\r\n Node: 18.8.0 - ~/.local/share/nvm/v18.8.0/bin/node\r\n Yarn: 1.22.19 - ~/.local/share/nvm/v18.8.0/bin/yarn\r\n npm: 8.18.0 - ~/.local/share/nvm/v18.8.0/bin/npm\r\n Browsers:\r\n Chrome: 106.0.5249.103\r\n Firefox: 105.0.2\r\n Safari: 15.3\r\n npmPackages:\r\n @trpc/client: ^10.0.0-proxy-beta.17 => 10.0.0-proxy-beta.17\r\n```\r\n\r\n\r\n### Describe the bug\r\n\r\nTypescript can't complete the typing of a query, see discussion https://github.com/trpc/trpc/discussions/2963\r\n\r\n\r\n`Property 'subscribe' does not exist on type 'DecoratedProcedureRecord\u003Cunknown, BuildProcedure\u003C\"subscription\", { _config: RootConfig\u003C{ ctx: {}; meta: {}; errorShape: never; transformer: CombinedDataTransformer; }>; _ctx_out: {}; _input_in: unique symbol; _input_out: unique symbol; _output_in: u\r\n nique symbol; _output_out: unique symbol; _meta: {}; }, Observable\u003C....'.`\r\n\r\n### Link to reproduction\r\n\r\nhttps://github.com/Lilja/trpc-v10-server-needed\r\n\r\n### To reproduce\r\n\r\nOpen up `src/index.ts` and modify the `type {AppRouter}` import, point it to the trpc repo OR a another router.\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[],2972,"bug: @trpc/server needed in the frontend for types to work","2022-10-11T08:18:00Z","https://github.com/trpc/trpc/issues/2972",0.656368,{"description":3245,"labels":3246,"number":3249,"owner":3176,"repository":3176,"state":3204,"title":3250,"updated_at":3251,"url":3252,"score":3253},"### Provide environment information\n\n```\nSystem:\n OS: macOS 15.3\n CPU: (8) arm64 Apple M2\n Memory: 2.18 GB / 24.00 GB\n Shell: 3.2.57 - /bin/sh\n Binaries:\n Node: 22.12.0 - /usr/local/bin/node\n npm: 11.0.0 - /usr/local/bin/npm\n pnpm: 9.15.4 - /usr/local/bin/pnpm\n Browsers:\n Brave Browser: 132.1.74.48\n Safari: 18.3\n npmPackages:\n @tanstack/react-query: ^5.65.1 => 5.65.1 \n @trpc/client: 11.0.0-rc.730 => 11.0.0-rc.730+776d07336 \n @trpc/react-query: 11.0.0-rc.730 => 11.0.0-rc.730+776d07336 \n @trpc/server: 11.0.0-rc.730 => 11.0.0-rc.730+776d07336 \n next: 15.1.6 => 15.1.6 \n react: ^19.0.0 => 19.0.0 \n typescript: ^5 => 5.7.3 \n```\n\n### Describe the bug\n\nI write protected `procedures` and throwing error from middleware-\n\n```\nimport { initTRPC, TRPCError } from \"@trpc/server\";\n\n//Context\nimport { Context } from \"./context\";\n\n\nconst t = initTRPC.context\u003CContext>().create();\n\nexport const router = t.router;\nexport const procedure = t.procedure.use(\n async function isAuthed(opts) {\n const { ctx } = opts;\n if (!ctx.user) {\n throw new TRPCError({ code: \"UNAUTHORIZED\", message: \"Unauthorized request. Please login\" })\n }\n return opts.next({\n ctx: {\n user: ctx.user\n }\n })\n }\n);\nexport const publicProcedure = t.procedure;\nexport const createCallerFactory = t.createCallerFactory;\n```\n\nHere I throw error for unauthorized request. There this is createContext-\n\nimport { getSession } from \"../auth/next-auth\";\n\nexport const createContext = async () => {\n const user = await getSession();\n return user;\n}\n\nexport type Context = Awaited\u003CReturnType\u003Ctypeof createContext>>;\n\nAnd on a now server page component-\nI just prefetch one request-\n\n```\n//TRPC\nimport { trpc, HydrateClient } from \"@/trpc/server\";\n\nconst Page = async () => {\n //TRPC\n await trpc.unavailability.list.prefetch();\n\n return (\n \u003CHydrateClient>\n \u003CList />\n \u003C/HydrateClient>\n );\n};\n\nexport default Page;\n```\nAll is working on local development is perfect. But when I try to build it-\n\n```\nError occurred prerendering page \"/unavailability\". Read more: https://nextjs.org/docs/messages/prerender-error\nTRPCClientError: Unauthorized request. Please login\n at s.from (/vercel/path0/.next/server/chunks/949.js:3:83107)\n at /vercel/path0/.next/server/chunks/949.js:3:89907\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\nExport encountered an error on /(dashboard)/unavailability/page: /unavailability, exiting the build.\n ⨯ Static worker exited with code: 1 and signal: null\n ELIFECYCLE Command failed with exit code 1.\nError: Command \"pnpm run build\" exited with 1\n\n```\n\n\nSo, it is natural that on build time, there is no authentications. But it stopping to build it-\n\n\n\n\n### Link to reproduction\n\nhttps://github.com/wegreet/dashboard-new-design\n\n### To reproduce\n\nJust build it with vercel\n\n### Additional information\n\n_No response_\n\n### 👨👧👦 Contributing\n\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3247,3248],{"name":3229,"color":3230},{"name":3173,"color":3174},6441,"bug: TRPC with nextjs 15(App Router) production build failed!","2025-02-05T17:24:47Z","https://github.com/trpc/trpc/issues/6441",0.6595295,{"description":3255,"labels":3256,"number":3258,"owner":3176,"repository":3176,"state":3204,"title":3259,"updated_at":3260,"url":3261,"score":3262},"### Provide environment information\r\n\r\n```shell\r\nSystem:\r\n OS: Windows 10 10.0.22621\r\n CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor\r\n Memory: 18.04 GB / 31.93 GB\r\n Binaries:\r\n Node: 18.15.0 - C:\\Program Files\\nodejs\\node.EXE\r\n Yarn: 1.22.19 - C:\\Program Files\\nodejs\\yarn.CMD\r\n npm: 9.6.7 - C:\\Program Files\\nodejs\\npm.CMD\r\n pnpm: 8.6.5 - C:\\Program Files\\nodejs\\pnpm.CMD\r\n Browsers:\r\n Edge: Spartan (44.22621.1848.0), Chromium (114.0.1823.67)\r\n Internet Explorer: 11.0.22621.1\r\n npmPackages:\r\n @tanstack/react-query: ^4.18.0 => 4.18.0 \r\n @trpc/client: ^10.33.0 => 10.33.0 \r\n @trpc/next: ^10.33.0 => 10.33.0 \r\n @trpc/react-query: ^10.33.0 => 10.33.0 \r\n @trpc/server: ^10.33.0 => 10.33.0 \r\n next: ^13.4.7 => 13.4.7 \r\n react: ^18.2.0 => 18.2.0 \r\n typescript: ^5.1.3 => 5.1.3\r\n```\r\n\r\n### Describe the bug\r\n\r\n## Context\r\nI am currently experiencing an issue with the blog example provided by tRPC. When accessing a specific article using the URL, for example by refreshing the page /post/post_id, two calls are made to trpc.post.byId.useQuery. One call is made with the correct article ID extracted from the URL, while the other call is made with an 'undefined' value.\r\n***\r\nThis issue occurs only when SSR (Server-Side Rendering) is set to false in the configuration file located at @/lib/trpc.ts\r\n***\r\n\r\n## Expected Behavior\r\nWhen accessing a specific article using the URL, I expect trpc.post.byId.useQuery to correctly use the extracted article ID from the URL to make a single API call.\r\n\r\n## Current Behavior\r\nWhen accessing a specific article using the URL, two trpc.post.byId.useQuery calls are made. One call succeeds using the extracted article ID from the URL, while the other fails with an error as it receives an 'undefined' value for the article ID.\r\n\r\n### Link to reproduction\r\n\r\nhttps://stackblitz.com/github/trpc/examples-next-prisma-starter\r\n\r\n### To reproduce\r\n\r\nRun the blog example provided by tRPC.\r\n[examples-next-prisma-starter](https://github.com/trpc/examples-next-prisma-starter)\r\nAccess a specific article using the URL, for example by refreshing the page http://localhost:3000/post/4d9a7d67-7a12-4f17-b88b-32132ae0445f\r\nObserve the calls to trpc.post.byId.useQuery and any errors in the browser console.\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### 👨👧👦 Contributing\r\n\r\n- [ ] 🙋♂️ Yes, I'd be down to file a PR fixing this bug!",[3257],{"name":3229,"color":3230},4592,"bug: handling 'undefined' values in the blog example when (ssr: false)","2025-03-20T15:41:47Z","https://github.com/trpc/trpc/issues/4592",0.6608507,["Reactive",3264],{},["Set"],["ShallowReactive",3267],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$f2WvARHloFJSJaeFQ9C6Td5Dxf9LO3sk4Mr2JQZaj33M":-1},"/trpc/trpc/4826"]