121 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
87
views
TRPC prefetching fails on protected procedure
I was working on a nextjs monorepo using trpc as backend I am integrating SSE with normal trpc methods, I implemented auth using better auth and it works very smoothly, but when I try to prefetch on ...
1
vote
1
answer
42
views
How to "extract" the generic type from a generic arrow function?
I'm attempting to use tRPC to create a virtual backend router, in which the client uses splitLink in order to direct the HTTP request to the appropriate microservice.
I am attempting to import several ...
0
votes
0
answers
214
views
Integrating Hono.js with tRPC in Next.js: Routing and Context Considerations
I want to combine Hono.js with tRPC. I followed the guide on the 3rd party middleware made by hono for a tRPC server, and now I have set up the hono tRPC server 3rd party middleware similar to the ...
1
vote
0
answers
211
views
No cookie in request headers from tRPC client received at tRPC server
I try to get cookies of the request from tRPC client using this context.ts of tRPC server:
import { IncomingMessage, ServerResponse } from 'http';
export async function createContext({ req, res }: { ...
2
votes
0
answers
501
views
How do I add a global error handler that can translate errors into different TRPCErrors?
In my TRPC app, I have a service that we use that does something like this:
export class MyCustomService {
public myCustomMethod() {
throw new MyCustomError('I am a custom error message!')
}
}
...
-1
votes
2
answers
526
views
how to get a successful auth-callback message from trpc.authCallback.useQuery()? (react query v5 2024)
I've been trying to build a chatPDF project from Josh Tried Coding - on youtube
(https://www.youtube.com/watch?v=ztBJqzBU5kc&t=7558s). the problem for me starts at 2:06:00 when his useQuery() ...
2
votes
0
answers
152
views
Is there a way to unwrap response when using trpc express adapter?
I have been using trpc [enter link description here][1]
And what I have seen is it always wraps the response inside result.data object. so all endpoints respond with
{result : {data:{ ...
0
votes
1
answer
1k
views
Tanstack react query useInfiniteQuery data is not updated client data, the server returns the updated data
I have a problem using react query with my trpc api.
I am using an infiniteQuery, the staletime is 0, when I come on the screen the query is fetching and the server returns the updated data but in ...
0
votes
1
answer
364
views
Why does tRPC's context get reset on every procedure (websockets)?
I'm trying to store state in the tRPC context between different procedures called by the same user. I use websockets/wsLink, so context is created once when the user first connects. This context ...
0
votes
1
answer
2k
views
Unexpected return type when using `useQuery` from @trpc/react-query
Full source here, for reference.
I'm fairly new to TypeScript, and brand new to NextJS (13.4) and tRPC. I'm working on building something to understand how the stack works.
For a quick bit of context, ...
1
vote
1
answer
66
views
Conditional call hook to server
I would like to have a component that show fake data and if the user choose some config it will call the server using TRPC:
const { date } = useDateStore();
const [config, setConfig] = useState<...
1
vote
0
answers
800
views
Clerk authMiddleware throwing errors with publicRoutes when signed out
I began learning the T3 stack following this tutorial:
https://www.youtube.com/watch?v=YkOSUVzOAA4&t=1836s
I have middleware thats supposed to send users to a sign in page when they're logged out. ...
1
vote
0
answers
580
views
tRPC not fetching data correctly with nextjs pages router
I'm following the TRPC documentation to fetch data server side and avoid loading state while keeping refetching and what not.
Using Next JS with pages router.
I'm getting the data server side using ...
2
votes
1
answer
4k
views
How to do error handling in tRPC using NextJS 13 app router?
I want to avoid duplicating try/catch error handling in my procedures by creating a global error handler in tRPC.
Where are you supposed to add an onError function? The documentation for error ...
0
votes
1
answer
3k
views
Expo + tRPC: Unable to retrieve application context. Did you forget to wrap your App inside `withTRPC` HoC?
I have pretty simple tRPC server:
// server.ts
import { initTRPC } from "@trpc/server";
import { z } from "zod";
const t = initTRPC.create();
export const appRouter = t.router({
...