santi
Use TRPCClientError.cause in frontend
Hi all,
My TRPC route can sometimes fail. Say the error is
CartValidationError
In the frontend, I want to be able to do:
The problem is that the error is of type TRPCClientError. In the backend, I can see that the error.cause
is what has the real error (CartValidationError
)
Is there a way for me to make the backend return the error in it's original type so I can use instanceOf? If not, can I use error.cause in the frontend? (doesn't seem possible yet)2 replies
Is it possible to get the procedure name / id in middleware?
I want to create a caching middleware that in some routes, stores a cache key that contains the route id (example: catalog.product.findMany) and the input (example: { categories: shirts }). It's not clear to me if this is possible.
8 replies
Create client that is used in every request, without re-creating client
Hi all,
Consider the following
This is annoying in local development because it needs to create the nest app for every request. The same thing with the prisma client.
We'd like to create this once and use in every request. Is this possible?
6 replies
Bug where 2 requests are fired at once. TRPC batches them. Can I cancel the 2nd via ProcedureOption?
Hey all. I have a bug where my app fires two identical requests at the same time. This happens do to some weird upstream auth listener logic. Ideally TRPC can help me mitigate this. I want to configure
ProcedureOption
such that it doesn't batch, but rather only lets the first request to go through. Is this possible?
4 replies