Input is too big for a single dispatch

I decided to try tRPC for my Crypto analytics dashboard. However, I'm having a hard time passing the time series data between the client & the server. First I received an HTTP error Request header too large I was able to fix this by setting maxURLLength However, now I receive another error "Input is too big for a single dispatch" So my question does tRPC even support such queries, where you send long arrays of data as inputs?
N
Nick425d ago
Is this is a query? Might be worth trying a mutation instead, tRPC currently uses GET for queries and that has limitations
Z
zrilman425d ago
Yes. It's a query. I've ended up with switching to mutation 😄
UU
Unknown User416d ago
N
Nick416d ago
Yeah this is a limitation right now AFAIK, there is chatter about making queries more flexible, like using a POST under the hood, just not sure where the core team are with that. In general though, sending a large amount of data by a query is probably a code-smell. I am aware there are some legit use cases though
UU
Unknown User416d ago
I
isaac_way416d ago
It's pretty easy to just wrap a mutation call in a react query useQuery hook, probably the simplest workaround I think:
import {useQuery} from '@tanstack/react-query';

function usePostsQuery() {
const client = api.useContext().client;
return useQuery({queryFn: async ()=>{
return await client.posts.getPosts.mutate();
}})
}
import {useQuery} from '@tanstack/react-query';

function usePostsQuery() {
const client = api.useContext().client;
return useQuery({queryFn: async ()=>{
return await client.posts.getPosts.mutate();
}})
}
More Posts
How to manage custom errors (e.g. custom error codes) in tRPC?What's the recommended way to add fields to a TRPCError? How do you make that typesafe also on the ctypesafe permissionsHi, So I wanted to infer all the procedures from my router recursively & assign a permission (stringawaiting for procedure & logging the response.Hi, I was wondering if there is a way to handle the return object via the post-middleware's? I know createCaller Dependency Injection in Middleware ctx ?`createCaller` makes it really easy to inject dependencies via anything that's created during the `cbest practices for organizing routes/procedures?i'm trying to find some practices/styles in which people generally define routes with trpc. currentlValidating input inside middleware declaration```js const enforceUserIsCreatorOfEvent = t.middleware(({ ctx, next, input }) => { if (!input.evenFetch errors on stale pagesRecently I have been getting a lot of fetch errors on stale pages, in particular ones that have querHow to use querykeys from react-queryI am trying to implement a search query to an api that i am fetching via a procedure, i also read onDistribute typesafe tRPC Client in an NPM libraryHi ! super fan of trpc over here. We are building a javascript sdk for our API that is essentiallyWebsocket is not defined errorI'm getting a "WebSocket is not defined error" on my next app connected to an express backend. Any i@trpc/server in a non-server environment Error in Azure CIIm trying to add vitest unit tests for my trpc procedures. I followed some examples and on the localHow are people handling authorization?I noticed that with V10, any mentions of `trpc-shield` are gone from the documentation. Also, it onlVitest context router callerHi, Im trying to setup vitest to test trpc. I would like to have a trpc approuter caller to be accesWebSocket connection hangs after significant amount of data passed through the connection.Hey! I've been really enjoying using tRPC on my latest project, but have gotten stuck getting webso