T
tRPC

Input is too big for a single dispatch

Input is too big for a single dispatch

Zzrilman2/18/2023
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?
Nnlucas2/18/2023
Is this is a query? Might be worth trying a mutation instead, tRPC currently uses GET for queries and that has limitations
Zzrilman2/18/2023
Yes. It's a query. I've ended up with switching to mutation 😄
UUUnknown User2/27/2023
Message Not Public
Sign In & Join Server To View
Nnlucas2/27/2023
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
UUUnknown User2/27/2023
Message Not Public
Sign In & Join Server To View
Iisaac_way2/27/2023
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();
}})
}

Looking for more? Join the community!

T
tRPC

Input is too big for a single dispatch

Join Server
Recommended Posts
typesafe 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 querDistribute typesafe tRPC Client in an NPM libraryHi ! super fan of trpc over here. We are building a javascript sdk for our API that is essentiallyMutation or query for something that updates db, but runs on every app load?I have 2 operations that need to run before showing my app UI. Those operations perform updates in DWebsocket 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 accesCannot read properties of undefined (reading 'data') of res.error.data, when trpc errors outHello everyone, I am using `@trpc/react-query` alongside `trpc` for express, and I am experiencing aExtending middlewareshttps://trpc.io/docs/middlewares#extending-middlewares Is this available?