T
tRPC

Using HTTP:POST for `query`?

Using HTTP:POST for `query`?

Hhsubra898/31/2023
Hey guys, thanks for the awesome library! My application involves making a query with a large amount of JSON data. However, since we use HTTP:GET under-the-hood for queries ( including batching ), I run into header length limits. Since we deploy to AWS, we are also restricted to the length limit imposed by Amazon ALB. Due to this, I have the following questions : - Is it currently possible to use HTTP:POST for query and mutation? - If not, is there any appetite to support it? - It would be easier for batching use-cases ( since the size limits of the batch can be a lot larger by default ), reduced code-complexity over-all, and also be consistent with other RPC implementations that only use POST for all transport.
Hhsubra898/31/2023
In order to unblock myself, i'm just using react-query to wrap the useMutation explicitly which i've extracted into an abstract function. However, not having to deal with this issue at-all would be ideal.
Nnlucas8/31/2023
Using a mutation is the right workaround It's not a great idea to run useQuery with a lot of input data, and is indicative of a problem with the code at large. Mutations are more suited There has been talk of supporting custom verbs for queries, but you'd be best to look at github for the outcomes of that
Hhsubra898/31/2023
At the end of the day, they are both RPC calls and the input / output shouldn't matter. The only reason there is any difference between whether something is a mutation / query at all seems to be for cleaner integration with react-query. Rather than allow customising the underlying verb, using POST for everything would simplify everyone's lives IMO. I don't really see why there's any need for the HTTP verb to change based on whether something is a query or mutation within the app. The transport is mostly abstracted from the user anyway.
Nnlucas9/1/2023
Caching and GET verbs go together on the web, that's the main reason IIRC 🙂
Hhsubra899/1/2023
Hmm, good point. However, caching API responses doesn’t seem like a standard use case. Especially if it’s behind auth as well. I was also under the impression that as long as cache-control headers are present, POST requests will be cached as well ( by CDNs and the browser )

Looking for more? Join the community!

T
tRPC

Using HTTP:POST for `query`?

Join Server
Recommended Posts
re validation on static site next js 13Hi, does any one know how to make revaluation when I’m fetching data on the server client from DB wiTransformers not transforming data (trpc-sveltekit)I'm having some trouble getting superjson to do its magic with tRPC & SvelteKit. I have a `client.tsIssue Inferring Type on Frontend with ElectroDB Query Return StatementHi all, I am using ElectroDB to work with DynamoDB, and I have a Lambda function that uses tRPC thaWrong JSON response when deployedWhen testing in localhost in dev mode there is no issue and the response is correct as expected. BuExternal callsHi! I am using T3 stack, tRPC together with clerk, and i need to create users within the app, being Need help identifying the generic client side type of proceduresHi! I think my question is better explained by what I'm trying to achive than anything else: I likIs there a way to use versioning for procedures?I want to make multiple versions (v1 / v2) for a procedure, can i do it in procedure level?createSSGHelpersI'm trying to fetch data in getStaticProps and getting the issue "Promise<{ paths: { params: { id: nTRPC undefined when exportingHi i am working on merging routers from different files but when exporting the router property it coTRPC retries with new app dir```ts let { data: name, isLoading, isFetching, isError, error } = trpc.home.home.useQuery(); ```opts.input is of type undifined```ts register: publicProcedure.input( RegisterSchema ).mutation(async (opts) => { Server-side error tracing with DatadogHey, has anyone had any luck setting up tracing with tRPC? Specifically with `dd-trace-js`. We’re uConfiguration helpHello! I want to apply the following configuration on the client: https://tanstack.com/query/v4/docI'm curious to know if anyone has any suggestions on how I can track the replies to the emailsI'm curious to know if anyone has any suggestions on how I can track the replies to the emails I sentRPC subscription : Access to socket ID from subscriptionI'm trying to implement user online status in a reliable way on my app, on the "live" part of my appHaving Issue With Context in App Directory Next.jsI am having an issue with creatin the trpc context with both the session and prisma. I am trying to tRPC querying data via function not workingIn the below code, `fetchSocialMediaData` is logging `themeId` but, not `response`, getting error asNext.js app router + TRPC...how to set it up?> **Note** > You can already use tRPC with app directory, by: > > - using `@trpc/client` directly inHow do I setup App router + TRPC + Lucia Auth? (protected routes)I'm trying to setup tRPC with Lucia in app router but I struggle to make protected routes work. I mNEXT.JS / Serverless AWSConfigured trpc locally. Everything works great. When deploying via serverless on aws - mutations do