-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qstash implementation #135
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good and QStash looks very nice and easy to use.
Curious:
- It looks like QStash is Redis-backed by UpStash, is there an option to bring our own Redis?
- How long can the QStash jobs run for? Is there a limit to those requests that hit the
/api/webhooks/qstash
endpoint?
I think the next step here would be to get feedback internally from other folks on DevEx to see how we feel about making this part of the official example.
Assuming we decide on that, the README will need some updates in the section around webhook handling. We may even want to tweak the implementation a bit to make the QStash part optional so that:
- If
QSTASH_*
ENV vars are set, then we use QStash - If not, then we process the webhook synchronously
Many of the features of stream.new are implemented in that optional way based on the existence of env vars (Google content moderation, Hive content moderation, Slackbot moderator, etc.). The reason for this is that folks use stream.new as a reference application, so it gives some flexibility to get the application running quickly with minimal setup and then enabling functionality as needed.
Overall, I really like this and it'll solve the webhook timeout issues we've been seeing 🙌🏼
Thanks for the review @dylanjha :) About using our own redis, let me get back to you after doing some research. Also I already started working on making QStash optional depending on the variable (just like how we have mux webhooks). One of the other solution I was thinking is using BullMQ (library), it allows us to use redis as message queue and will also provide more features and control to us. But it won't be serverless, we will need another instance to run BullMQ workers. Read more about BullMQ: https://docs.bullmq.io/ |
It looks like Upstash does not provide an option to bring our own redis cluster. They do provide an option to publish message additionally to kafka (only kafka) topic, but can't find anything to replace underlying redis. |
type WebhookRequestBody = { | ||
type: string; | ||
object: any; | ||
id: string; | ||
environment: any; | ||
data: any; | ||
playback_ids?: any[]; | ||
duration: number; | ||
created_at: string; | ||
accessor_source: string; | ||
accessor: string; | ||
request_id: string; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a place where I can get all available fields of the webhook request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has been some work on this recently by techops team, ask in #devex-dev channel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the spec/webhook/samples
directory in this PR: https://github.com/muxinc/openapi-specification/pull/181
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jaredsmith :)
Cool, not a blocker, was just curious
@rozig makes sense. I say we stick with the serverless solution so you go one of two ways:
Makes sense on the QStash side of things, but there is a concern on the Vercel side. The endpoint hits |
Hey guys,
Thanks for choosing QStash and please let me know if you have any questions. |
Thanks @chronark! Appreciate the comment. Some of the folks on the team are busy with a conference this week, but we intend to loop back on this when we get back and get this wrapped up! |
Description
Implemented Qstash to handle webhook events asynchronously.
Workflow:
/api/webhooks/mux
In the background:
/api/webhooks/qstash