upstash / qstash-js

Message queue for serverless
https://docs.upstash.com/qstash
MIT License
170 stars 21 forks source link

Feature request: TRPC middleware #46

Open levi opened 1 year ago

levi commented 1 year ago

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.

chronark commented 1 year ago

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

kilinkis commented 1 year ago

Interested as well

johnoppenheimer commented 11 months ago

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!