T3 app tRPC external calls

Currently i'm just making Post request and formatting my payload to
{
"0": {
"json": {
....data <--- actual data.
}
}
}
{
"0": {
"json": {
....data <--- actual data.
}
}
}
format. It works. Saw that people use trpc-openapi for that. Is it really necessary? What are downsides of my approach?
D
Dani;327d ago
Are you sending the request from a non-TS client? If so I suggest using trpc-openapi, that way you can strictly define REST-compliant endpoints. You also get the benefit of an openapi.yml schema, which you can use to generate HTTP clients in various programming languages. Your approach can (unlikely) break if there's any changes of the internal schema used by tRPC. This will likely not happen, but who knows?
M
MadaShindeInai327d ago
I'm sending a request from Clerk webhook (user.create, and maybe user update later). Maybe there are some kind of more smooth solutions for that?
D
Dani;327d ago
Your approach is fine IMO, maybe someone else has better ideas on how to handle it.
AK
Alex / KATT 🐱327d ago
you can simplify it a bit by removing ?batch=1
AK
Alex / KATT 🐱327d ago
you can read the RPC spec here https://trpc.io/docs/rpc
HTTP RPC Specification | tRPC
Methods Type mapping
M
MadaShindeInai325d ago
yeah. It become a bit easier. Maybe you also can suggest an easy way to check from what domain request was sent? (To drop everything that was sent not from Clerk) Upd. found that if using Clerk's webhooks, in opts.req.headers getting 'svix-webhooks/ ..." as user-agent. Will use that is identifier. Thank you.
More Posts
Next-auth session not being fetched in tRPC contextNext-auth session not being fetched in tRPC contextuseMutation not handeling arguments correctly.Hello, I have a mutation setup on the server with the input being an object containing the fields emUpdate Clerk Organization from TRPC Router (T3 Stack)Hello, if anyone got an idea on how to handle this I would highly appreciate it. I have some organiHow to not send request in specific condition in useQuery()```js const { data: artists, isLoading } = api.findArtist.useQuery({ name: search, }); ``` TRPCClientError: fetch failedI get the below error when createTRPCProxyClient runs on BE of a Next.JS app hosted on Vercel: ```TinferRouterOutputs not inferringCould anyone point me in the right direction to why my types aren't being inferred here? (Using T3 bModular Router ThoughtsHello, I hope I can convey clearly what I hope to accomplish. To start, I have a monorepo, with a feIssue with trpc fetch when trying to pass Clerk auth to contextI'm currently trying to add Clerk auth to my trpc context, but I just keep getting this error: `ErrBullMQ + TRPCCurious how to configure BullMQ with TRPC correctly. Currently I have the queue, queueevents, and thTrpc refetches all of the queries when i run a mutationIm running node 16.15.0 with Pnpm When i run a mutation for some reason all of the queries get refettRPC Client on NodeJS server keeps complaining that no fetcher has been configuredHey, I want to create a tRPC setup where I have one server (works fine) and then a client which is cBest Practice to Fetch a Query OnDemandWhat's the best practice to fetch a query on demand? I don't have the context for the query's inputOutput Response ShapeI'm wondering, is the output response shape locked in, or can we modify it in any way? For example: Need help```js import {initTRPC} from '@trpc/server'; import * as trpcNext from '@trpc/server/adapters/next';useQuery hook modify data on fetch.Hello is it possible to modify the data that is fetched with useQuery hook in tRPC basically im storAccepting a DecoratedProcedure with inputs and outputs that extend some given typesIs there any way to accept a DecoratedProcedure that extends { mutate: Resolver<TProcedure> } where useEffect and useMutation error about conditional rendering of hooksI am using t3 stack with tRPC, and I am trying to mark all emails as seen when the page loads by usiGuide to create an adapterIs there a guide on the docs that explains the basics to create an adapter?Does tRPC websocket client supports wss protocol?After changing the websocket client url from ws to wss, it fails to connect. Tested out the connectiGet the type of context after middlewareHow can I get the type of the context of `adminProcedure` from `export const adminProcedure = public