Switch language한국어
Back to the list

How I bypassed Vercel Serverless timeouts to build a decoupled document ingestion pipeline

TL;DR AI

Key summary

2 min read
  1. The article explains how document ingestion and embedding jobs were moved off Vercel serverless routes into a queued worker pipeline to avoid timeout limits.

  2. Next.js routes handle validation and job enqueueing, while BullMQ and Redis coordinate background processing through a persistent Railway worker.

  3. The worker streams files from Cloudflare R2, chunks text, generates embeddings, and uses Postgres locking to safely update quotas and ensure idempotency.

  4. A stateless pass-through mode can also return embeddings via webhook without storing data, making the system useful for RAG and other async AI workflows.

Read the original