Vercel and background jobs: how to organize queues, cron, and long-running tasks

Published on 2026-11-14 by frfrand

Practical architecture for separating frontend, HTTP functions, jobs, queues, and workers when tasks do not fit within Vercel's execution time.

Vercel and background jobs: how to organize queues, cron, and long-running tasks

Vercel is a good option for deploying frontends and HTTP functions, but an HTTP function is not necessarily a permanent worker. If your application must generate long reports, process thousands of documents, or consume a queue continuously, it is advisable to design execution explicitly.

1. Distinguish four types of work

| Need | Common pattern | |---|---| | Immediate response | Small HTTP function | | Decoupled processing | Queue work and respond with identifier | | Periodic execution | Scheduler that triggers a task | | Process that listens to a queue all day | Resident worker in a service suitable for it |

A function has a maximum duration subject to runtime, configuration, and plan; exceeding it causes an error. Do not claim that all Vercel functions have the same limit: values change with Fluid Compute and the plan.

2. Design retryable tasks

To export thousands of rows, the HTTP endpoint validates permissions, creates a job record in PostgreSQL, publishes a message to the queue, and responds 202 Accepted with the ID. The worker processes and updates states such as queued, running, completed, and failed.

Users check the status via an endpoint; downloading the result should use appropriate storage and a URL with expiration if there is private information.

3. Idempotency and failures

A queue can deliver messages more than once. Identify each task, prevent duplicate charges or communications, and define retries with backoff. Log the failure cause and create an error queue for items that exhausted their attempts. Keep secrets on the server and verify permissions before allowing result queries.

If the task lasts minutes or hours, do not keep it artificially open within a request. Split it into blocks or use a worker suited to the required time and memory.

4. What to do with cron

Cron jobs on a platform usually trigger invocations, they do not guarantee that an application process remains active between executions. Protect the cron endpoint, handle overlaps, and store a cursor or last job marker; a restarted process should not repeat everything.

5. Hybrid architecture

A valid architecture is: Next.js frontend on Vercel → API and PostgreSQL → Redis queue or equivalent → worker on VPS. You can also keep the API on Vercel if its times and limits fit your application. Do not introduce Redis without a concrete need: a jobs table in PostgreSQL may be enough at first.

To implement this separation, review Vercel with backend and PostgreSQL on ArduMaker, ArduMaker vs Vercel and automations and cron tasks.

Frequently asked questions

### Can't I run long jobs on Vercel? Some yes, as long as limits, configuration and runtime behavior are respected.

Does a cron equal a worker?

No; a cron schedules executions, while a worker can consume work continuously.

Is Redis mandatory?

No; it depends on volume, queue semantics and operational requirements.

Sources: Vercel Functions limits and configure duration.

  • Vercel
  • workers
  • cron
  • serverless
  • colas

Keep reading

All articles · VPS plans