\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!",[2923,2926],{"name":2924,"color":2925},"👻 invalid","e4e669",{"name":2927,"color":2928},"🐛 bug: unconfirmed","e99695",6441,"bug: TRPC with nextjs 15(App Router) production build failed!","2025-02-05T17:24:47Z","https://github.com/trpc/trpc/issues/6441",0.67709035,{"description":2935,"labels":2936,"number":2946,"owner":2871,"repository":2871,"state":2907,"title":2947,"updated_at":2948,"url":2949,"score":2950},"So. We're making a new major. \r\n\r\n\r\n\r\n\r\n\r\n## Goals\r\n\r\n- **More ergonomic API for creating procedures** and building out your backend\r\n- **CMD+Click** from your frontend and jump straight into the backend procedure. This will work with `react-query` as well!\r\n- **Better scaling** than the current structure - the TypeScript server starts choking a bit when you get close to 100 procedures in your backend\r\n- **Fully backward compatible** for the 99% use-case with a migration path which you can do incrementally. \r\n\r\n\r\n## Todos\r\n\r\n> **Important for contributors:** All of the work here is related to the [`next`](https://github.com/trpc/trpc/tree/next) branch.\r\n\r\n\r\nTracked in https://github.com/orgs/trpc/projects/1\r\n\r\n- [x] New Router API\r\n - [x] Tracked in [trpc/v10-playground](https://github.com/trpc/v10-playground) - the current winning proposal is https://github.com/trpc/v10-playground/pull/33\r\n - [x] Error formatting in new API - [`formatError()`](https://trpc.io/docs/error-formatting)-equivalent. \r\n - [x] `meta`-equivalent\r\n - [x] Maybe we need a `createRootRouter()` that additionally accepts `{ transformer: X, formatError: Y}`\r\n - [x] Implement new API in tRPC\r\n - [x] Make old routers compatible (`.legacy()` at the end to transform them to the new version)\r\n- [x] New client API with backward compatibility \r\n - Maybe old can be `client.query('postById', input, options)` whilst new stuff can be `client.queries.postById({ input, ...options})`\r\n- [x] New react-query API with backward compat\r\n- [ ] Make actual issues for all of these\r\n- [x] Add all old projects in a folder (copy/paste `examples/*` to `examples/.test` so we can track breaking changes easily and make sure we remain backward compatible for a long time\r\n- [ ] Rewrite `TRPCClient` to be functional instead of a class but reuse the same interface\r\n- [ ] Write a migration guide\r\n - [ ] New router API\r\n - [ ] New links\r\n- [x] Move transformers back to `runtime` to make it backward compatible\r\n- [ ] Explore: Add [`stripInternal`](https://www.typescriptlang.org/tsconfig#stripInternal)-flag\r\n- [x] Simplify HTTP-responses\r\n- [x] New links architecture (#1366)\r\n- [ ] Refactor observables implementation to have `unknown` errors or make it guaranteed to be `TRPCClientError` of some sort. \r\n- [ ] Make transformers dynamically opt-in similar to how a batch request is indicated by `?batch=1` maybe a transformed request could be `?transform=1` or `transform=TRANSFORMER_NAME`?\r\n- [ ] Write a blog post about new major and API.\r\n- [ ] \"Marketing\"? Hype video, new website, etc\r\n- [ ] Decide on structure for react-query integration\r\n- [ ] Add old website on `www/`-docs as `v9.trpc.io`\r\n - [ ] Link it in Docusaurus\r\n - [ ] Make sure we have deployment for a \"v9\"-branch\r\n\r\n### Stretch\r\n\r\n- [ ] Add DTO for clients without transformers - #1694\r\n- [x] #1597\r\n- [x] New Subscriptions API (nice to have) - #1596 \r\n- [ ] `trpc.output.snapshot()` https://github.com/trpc/trpc/issues/3435\r\n\r\n\r\n\r\n\r\n\r\n\u003Cdetails>\u003Csummary>Old notes\u003C/summary>\r\n\r\n## Definite\r\n\r\n- [x] Remove official support for node `12.x`\r\n - [x] Remove E2E-test for 12.x\r\n - [x] Change `tsconfig` build target\r\n- [ ] Add official support for node `16.x`\r\n- [ ] Add `stripInternal`-flag\r\n- [x] Remove all `@deprecated` stuff\r\n - [x] Remove `LegacyRouter` introduced in #915\r\n - [ ] [...]\r\n- [x] New links architecture (#1366)\r\n- [ ] Move official support for `react-query` `3` to `4`\r\n- [ ] Simplify HTTP-responses\r\n - [ ] From `{ id:null, result: {type: 'data', data: x } }` -> `{ result: { data: x } }`\r\n - [ ] maybe remove `id: null` from HTTP responses?\r\n- [ ] Migration guides for all changed parts\r\n - [ ] New Links\r\n\r\n\r\n## Maybe ❓ \r\n\r\n> Feedback please!\r\n\r\n\r\n- [x] Optimize so router inference only needs to be done once? #1218 \r\n- [ ] ~Update so procedures needs to return `{ data: x }` instead of just `x` so we could add metadata and potentially discriminated union of `{ data: x } | { error: y }` ~\r\n- [x] Decide: \r\n - Pipe-based rather than object resolvers? `{ input: z.string(), resolve({input}) {}}` -> `t.pipe(t.input(z.string), ({input}) => \r\n - Chained resolvers\r\n- [x] Plan how to deal with degrading typescript performance when approaching ~100 procedures (there are no runtime issues, but the DX slows down) \r\n- [ ] Turn `client.query` result into `[ output, { meta } ]`\r\n- [ ] New `useQuery()` API that expects suspense as default - See this gist: https://gist.github.com/KATT/aa1ad532d6e57520b942f657569e1505\r\n- [ ] Refactor `@trpc/server` to easier work with CloudFlare-workers etc (#1375)\r\n- [ ] Collaborate with Blitz.js? https://github.com/blitz-js/blitz/discussions/3083#discussioncomment-1841427\r\n- [ ] https://jsonapi.org/format/\r\n\r\n### Transformers\r\n\r\n- [x] Turn transformers into a link on the client (#1366)\r\n- [ ] Revert above and put transformers back to runtime 😬 \r\n- [ ] ~Turn transformers into a middleware on the server~\r\n- [ ] Make transformers dynamically opt-in similar to how a batch request is indicated by `?batch=1` maybe a transformed request could be `?transform=1` or `transform=TRANSFORMER_NAME`?\r\n\r\n### Misc\r\n\r\n- [ ] Rename `@trpc/react/ssg` -> `@trpc/react/ssr` & `createSSGHelpers` -> `createServerSideHelpers` (or something, as it is often used in `getServerSideProps()` as well as `getStaticProps()`)\r\n\r\n## Open questions\r\n\r\n- Should we continue to follow OpenRPC?\r\n- Any changes that could make tRPC easier to support stuff like Svelte/Vue?\r\n- Any changes that could make tRPC stricter support stuff like AWS Lambdas? (Already is doable to do Lambdas but through an Express->Lambda converter) #882 \r\n- Ideas?\r\n\r\n\r\n\r\n\u003C/details>",[2937,2940,2943],{"name":2938,"color":2939},"🙏 review please","A7356F",{"name":2941,"color":2942},"💸 Get paid!","c2e0c6",{"name":2944,"color":2945},"next-major/definite","5319E7",887,"[RFC] Next major overview","2022-12-19T22:11:47Z","https://github.com/trpc/trpc/issues/887",0.677181,{"description":2952,"labels":2953,"number":2954,"owner":2871,"repository":2871,"state":2907,"title":2955,"updated_at":2956,"url":2957,"score":2958},"When trying to build my Next.js project, I'm getting the following error:\r\n\r\n```javascript\r\nTRPCClientError: request to http://localhost:3000/api/trpc/post.test?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D failed, reason: connect ECONNREFUSED ::1:3000\r\n at Function.from (/Users/matthias/Code/nx/agracheck/node_modules/.pnpm/@trpc+client@9.23.2_@trpc+server@9.23.2/node_modules/@trpc/client/dist/TRPCClientError-e9bf96e9.cjs.prod.js:69:14)\r\n at /Users/matthias/Code/nx/agracheck/node_modules/.pnpm/@trpc+client@9.23.2_@trpc+server@9.23.2/node_modules/@trpc/client/links/httpBatchLink/dist/trpc-client-links-httpBatchLink.cjs.prod.js:208:50\r\n at processTicksAndRejections (node:internal/process/task_queues:96:5) {\r\n originalError: FetchError: request to http://localhost:3000/api/trpc/post.test?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D failed, reason: connect ECONNREFUSED ::1:3000\r\n at ClientRequest.\u003Canonymous> (/Users/matthias/Code/nx/agracheck/node_modules/.pnpm/next@12.1.2_4ee95308deca1889961de2ade43e18f6/node_modules/next/dist/compiled/node-fetch/index.js:1:64142)\r\n at ClientRequest.emit (node:events:527:28)\r\n at Socket.socketErrorListener (node:_http_client:454:9)\r\n at Socket.emit (node:events:527:28)\r\n at emitErrorNT (node:internal/streams/destroy:164:8)\r\n at emitErrorCloseNT (node:internal/streams/destroy:129:3)\r\n at processTicksAndRejections (node:internal/process/task_queues:83:21) {\r\n type: 'system',\r\n errno: 'ECONNREFUSED',\r\n code: 'ECONNREFUSED'\r\n },\r\n shape: undefined,\r\n data: undefined,\r\n isDone: false,\r\n [cause]: FetchError: request to http://localhost:3000/api/trpc/post.test?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D failed, reason: connect ECONNREFUSED ::1:3000\r\n at ClientRequest.\u003Canonymous> (/Users/matthias/Code/nx/agracheck/node_modules/.pnpm/next@12.1.2_4ee95308deca1889961de2ade43e18f6/node_modules/next/dist/compiled/node-fetch/index.js:1:64142)\r\n at ClientRequest.emit (node:events:527:28)\r\n at Socket.socketErrorListener (node:_http_client:454:9)\r\n at Socket.emit (node:events:527:28)\r\n at emitErrorNT (node:internal/streams/destroy:164:8)\r\n at emitErrorCloseNT (node:internal/streams/destroy:129:3)\r\n at processTicksAndRejections (node:internal/process/task_queues:83:21) {\r\n type: 'system',\r\n errno: 'ECONNREFUSED',\r\n code: 'ECONNREFUSED'\r\n }\r\n}\r\n```\r\n\r\nMy `withTRPC` config looks like this:\r\n```javascript\r\nimport { withTRPC as withOriginalTRPC } from '@trpc/next';\r\nimport superjson from 'superjson';\r\nimport { AppRouter } from '../routers/_app';\r\n\r\nexport const withTRPC = withOriginalTRPC\u003CAppRouter>({\r\n config({ ctx }) {\r\n if (typeof window !== 'undefined') {\r\n // during client requests\r\n return {\r\n url: '/api/trpc',\r\n };\r\n }\r\n // during SSR below\r\n\r\n // optional: use SSG-caching for each rendered page (see caching section for more details)\r\n const ONE_DAY_SECONDS = 60 * 60 * 24;\r\n ctx?.res?.setHeader(\r\n 'Cache-Control',\r\n `s-maxage=1, stale-while-revalidate=${ONE_DAY_SECONDS}`\r\n );\r\n\r\n // The server needs to know your app's full url\r\n // On render.com you can use `http://${process.env.RENDER_INTERNAL_HOSTNAME}:${process.env.PORT}/api/trpc`\r\n const url = process.env.VERCEL_URL\r\n ? `https://${process.env.VERCEL_URL}/api/trpc`\r\n : 'http://localhost:3000/api/trpc';\r\n\r\n return {\r\n url,\r\n /**\r\n * @link https://trpc.io/docs/data-transformers\r\n */\r\n transformer: superjson,\r\n /**\r\n * @link https://react-query.tanstack.com/reference/QueryClient\r\n */\r\n // queryClientConfig: {\r\n // defaultOptions: {\r\n // queries: { suspense: false, useErrorBoundary: true },\r\n // mutations: { useErrorBoundary: true },\r\n // },\r\n // },\r\n headers: () => {\r\n if (ctx?.req) {\r\n // on ssr, forward client's headers to the server\r\n return {\r\n ...ctx.req.headers,\r\n 'x-ssr': '1',\r\n };\r\n }\r\n return {};\r\n },\r\n };\r\n },\r\n /**\r\n * @link https://trpc.io/docs/ssr\r\n */\r\n ssr: true,\r\n});\r\n```\r\n\r\nThis is the Next.js page that throws the error:\r\n```javascript\r\nexport function Index(props: InferGetStaticPropsType\u003Ctypeof getStaticProps>) {\r\n const { data } = trpc.useQuery(['post.test']);\r\n const { t } = useTranslation('common');\r\n\r\n return (\r\n \u003C>\r\n \u003Ch1>\r\n {t('h1')} {data?.test}\r\n \u003C/h1>\r\n \u003CSuspenseBoundary selector=\"post.test\">\r\n \u003Cspan>{JSON.stringify(data)}\u003C/span>\r\n \u003C/SuspenseBoundary>\r\n\r\n \u003CAuth />\r\n \u003C/>\r\n );\r\n}\r\n\r\nexport const getStaticProps: GetStaticProps = async (ctx) => {\r\n const ssg = await createSSGHelpers();\r\n\r\n await ssg.fetchQuery('post.test');\r\n\r\n return {\r\n props: {\r\n trpcState: ssg.dehydrate(),\r\n },\r\n };\r\n};\r\n\r\nexport default Index;\r\n```\r\n\r\nThanks for looking into this!",[],1846,"Error \"TRPCClientError: request failed\" when building a Next.js app","2022-04-28T17:37:27Z","https://github.com/trpc/trpc/issues/1846",0.6854639,{"description":2960,"labels":2961,"number":2965,"owner":2871,"repository":2871,"state":2907,"title":2966,"updated_at":2967,"url":2968,"score":2969},"Some recommendations for improvements to the API:\r\n\r\n- I don't really see any reason to split up `@trpc/server` and `@trpc/client`. I think they should be merged into a single `trpc` module. It makes the out-of-the-box experience so much cleaner.\r\n- Then the `@trpc` scope can be used for specific plugins/adapters etc. You could publish the Express adapter as `@trpc/express` for instance. That would also let you properly specify all the requisite peerDependencies (which I don't believe are specified using the current `@trpc/server/adapters/express` approach since it doesn't have its own package.json.\r\n- I think `import * as` imports are a bad user experience. I submitted a PR with a solution.\r\n- Simplify the function names: `createTRPCClient` => `createClient`, `createNextApiHandler` => `createHandler`, `CreateNextContextOptions` => `ContextOptions`. It should be standard across adapters. It's obvious that a function called `createHandler` imported from `\"@trpc/server/adapters/next\"` is creating a Next.js API handler. It doesn't need to be in the name.\r\n- The adapters should export a `createContext` function that can automatically type `opts` with the necessary types.\r\n- I think all requests (queries and mutations) should get served from a single URL. The `path` can be added as an additional query parameter for queries and in the `body` for mutations. This would also simplify the Next/Express adapters (no need for a catchall API route).\r\n\r\n\r\nLess important:\r\n\r\nI think there should be a way of manually typing the input of a resolver without passing a validator into `input`. This is easy to do if the resolver functions had two parameters instead of one. I have this working on a local branch (type inference still works the same).\r\n\r\nI propose this syntax/convention:\r\n\r\n```ts\r\nconst router = trpc.router\u003CContext>().query('test', {\r\n resolve(input: number, req) {\r\n return input;\r\n },\r\n });\r\n```\r\n\r\nThe `req` variable above if of type `{ ctx: TContext, type: ProcedureType }`. This leaves the door open to future API expansion, as `req` can act like a catchall for any additional properties we want to pass into resolvers. ",[2962],{"name":2963,"color":2964},"💬 discussion","4B318A",211,"API recommendations","2021-04-12T21:57:33Z","https://github.com/trpc/trpc/issues/211",0.6865448,["Reactive",2971],{},["Set"],["ShallowReactive",2974],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fPcOFJvDPYBJYNyoFYtA5HOi6gjIEz4d7-b3N8nCq-Bg":-1},"/trpc/trpc-openapi/289"]