qstash-js icon indicating copy to clipboard operation
qstash-js copied to clipboard

Feature request: TRPC middleware

Open levi opened this issue 2 years ago • 3 comments

I've hacked together a TRPC middleware for my v1 integration, but it seems to be broken with v2. Still debugging the issue, but would love to have an officially managed middleware I can use on specific TRPC endpoints.

levi avatar Sep 05 '23 22:09 levi

I think there was a community trpc adapter, but now I can't find it anymore I'll ask around

chronark avatar Sep 06 '23 08:09 chronark

Interested as well

kilinkis avatar Oct 03 '23 13:10 kilinkis

If it helps anyone, I made a gist with a working trpc middleware for QStash https://gist.github.com/johnoppenheimer/adc409f5a7aec65c4a14085a6b583038

I took inspiration from the nextjs handler and just made it more TRPC. The main thing is the body, TRPC expect the input of a mutation using POST to be inside a json attribute, so just shove the rawBody coming from the middleware options to inside it and it works.

Open to make a PR if that's helpful!

johnoppenheimer avatar Dec 11 '23 17:12 johnoppenheimer