Skill

Manage Serverless Message Queues with QStash

Upstash QStash serverless message queues, cron scheduling, and webhook delivery, with fixes for common pitfalls.

Works with cloudflare workersvercel functionsaws lambdanetlify functionsnextjs

78
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Leverage Upstash QStash for robust, serverless message queuing, scheduled jobs, and reliable HTTP task delivery without managing infrastructure.

Outcomes

What it gets done

01

Implement message queues for asynchronous HTTP calls.

02

Set up scheduled cron jobs for periodic background tasks.

03

Ensure secure webhook delivery through signature verification.

04

Handle message delivery callbacks and deduplication.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-upstash-qstash | bash

Overview

Upstash QStash

Covers Upstash QStash for serverless message queues, cron scheduling, and webhook delivery, with severity-rated fixes for signature verification, timeouts, rate limits, deduplication, and UTC cron scheduling. Use for reliable async HTTP delivery, serverless cron, webhook fan-out, or deduplicated critical operations; routes complex workflows, Redis queues, and event sourcing to other specialist skills.

What it does

This skill covers Upstash QStash for serverless message queues, scheduled jobs, and reliable HTTP-based task delivery without managing queue infrastructure - the core principle being that if an endpoint speaks HTTPS, it can receive QStash messages. It shows message publishing patterns (publishJSON with an optional delay or a specific notBefore timestamp), cron-based scheduled jobs (schedules.create with a cron expression, plus list/delete operations), mandatory signature verification (Receiver.verify() checked against both currentSigningKey and nextSigningKey for seamless key rotation, using the raw request body rather than parsed JSON), delivery-status callbacks (callback/failureCallback URLs that receive sourceMessageId/status/body), URL groups for fan-out to multiple endpoints at once, and message deduplication (a custom deduplicationId or contentBasedDeduplication hashing the body) to prevent double-processing of critical operations like payments.

Its most operationally valuable content is a set of severity-rated "sharp edges": skipping signature verification (CRITICAL - public endpoints accept forged requests from anyone who discovers the URL); slow callback handlers exceeding QStash's 30-second timeout (HIGH - causes false failures and duplicate retries; fix by acknowledging fast and queuing heavy work separately); hitting plan-based rate limits unexpectedly during traffic bursts (HIGH - free tier caps at 500 messages/day; fix with local retry queuing and batch publishing); skipping deduplication on critical operations (HIGH - network retries can double-charge or double-email without it); expecting QStash to reach localhost or private URLs (CRITICAL - it only reaches public HTTPS endpoints; use ngrok or a dev-mode bypass locally); one-size-fits-all retry configuration (MEDIUM - critical webhooks need more retries/longer backoff than non-critical notifications); sending large payloads instead of references (MEDIUM - QStash has a roughly 500KB body limit; send an ID and fetch the data in the handler); skipping callbacks on critical flows (MEDIUM - QStash is fire-and-forget by default, so no callback means no visibility into delivery success); and cron schedules assuming local time when QStash runs in UTC (MEDIUM - causes off-by-hours confusion, especially across DST).

When to use - and when NOT to

Use this skill for reliable async HTTP calls, serverless cron/scheduled jobs, webhook delivery and fan-out, and message deduplication without standing up dedicated queue infrastructure. It explicitly routes adjacent needs elsewhere: complex multi-step/stateful workflows to inngest, traditional Redis-backed queues to bullmq-specialist, event sourcing to event-architect, and durable workflow orchestration to temporal-craftsman.

It is not the right tool for those adjacent architectures - if the actual need is durable step functions with checkpointing, a Redis worker pool, or complex stateful orchestration, one of the named alternatives fits better than QStash's simpler HTTP-delivery model.

Inputs and outputs

Input is an async task needing reliable HTTP delivery - a delayed job, a recurring cron task, a webhook to fan out to multiple services, or a critical operation needing deduplication. Output is a QStash publish/schedule call with appropriate delay, retry, callback, and deduplication configuration, plus a receiving endpoint that verifies the upstash-signature header before processing.

ngrok http 3000

Integrations

Built on the @upstash/qstash SDK (Client and Receiver), deployable behind Next.js, Cloudflare Workers, Vercel Functions, AWS Lambda, or Netlify Functions. Composes with nextjs-app-router, vercel-deployment, stripe-integration, supabase-backend, email-systems, and slack-bot-builder in workflows like serverless background jobs, reliable webhook processing, scheduled reports, and fan-out notifications; pairs with inngest for gradual migration once workflows outgrow simple message delivery.

Who it's for

Developers building serverless background jobs, scheduled tasks, or reliable webhook delivery on platforms like Vercel or Cloudflare who want QStash's HTTP-based queue without managing Redis or a dedicated worker fleet.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.