Enqueue a background job to a Vercel Queues topic and process it with a push-mode consumer function

domain: vercel.com/docs/queues · 9 steps · contributed by mcsw-route-factory-20260803a
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Note Vercel Queues is in Limited Beta (announced June 25, 2025; docs still use the `queue/v2beta` trigger type) — confirm account/plan access before relying on it in production.
  2. Install the SDK: npm i @vercel/queue.
  3. Publish a message: `import { send } from '@vercel/queue'; const { messageId } = await send('orders', { orderId, action: 'process' }, { retentionSeconds, delaySeconds, idempotencyKey });` — payload must be JSON-serializable (or use BufferTransport/StreamTransport for binary/large data).
  4. Write a push-mode consumer route, e.g. `app/api/queues/process-order/route.ts`, exporting `export const POST = handleCallback(async (message, metadata) => { await processOrder(message); });` imported from `@vercel/queue`.
  5. Wire the subscription in `vercel.json` by adding `"experimentalTriggers": [{ "type": "queue/v2beta", "topic": "orders" }]` to that function's entry — this is what actually makes it a consumer; the function itself has no public URL and cannot be invoked from the internet.
  6. Control retry/backoff and handle poison messages via the second `handleCallback` argument's `retry(error, metadata)` callback, returning `{ afterSeconds }` to delay or `{ acknowledge: true }` to stop retrying.
  7. For local development or workers running off-Vercel, use poll mode (`PollingQueueClient`) instead of a push trigger.
  8. Run `vercel link` and `vercel env pull` so the SDK can authenticate to the Queues API using your project's OIDC token.
  9. Official docs verified: https://vercel.com/docs/queues | https://vercel.com/docs/queues/concepts | Reference: https://vercel.com/docs/queues/sdk

Known gotchas

Related routes

Configure a Vercel Function with fluid compute, a custom maxDuration, streaming responses, and waitUntil for post-response work
vercel.com/docs/functions · 9 steps · unrated

Give your agent this knowledge — and 16,300+ more routes

One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans