What is Cron job?

Work that runs on a schedule or in the background, instead of while someone waits for a page.

Where Cron job goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • Launch day · 4 minutes · Pro

    The reminder that never came

    Your app promises 'We'll remind you in 24 hours'. Nobody has ever received the reminder.

    Why doesn't setTimeout work in my serverless API?

    Serverless functions run for one request and stop shortly after responding, so timers scheduled inside them never fire. Store future work as data with a due time, and process it with a scheduled job (cron) or a queue that retries failures. Check your plan's cron frequency limits.

    Read the fix
  • Launch day · 4 minutes · Pro

    The 504 at second 60

    Generating a long AI report works on your laptop. In production, where the route's time limit is set to 60 seconds, big reports fail with '504 Gateway Timeout'.

    Why do I get a 504 timeout only in production?

    Hosted serverless functions stop at a set time limit, while your laptop has none. Long AI calls, imports or file processing exceed it and return 504 Gateway Timeout. Streaming improves the wait but still counts toward the limit; move long tasks to a background job that reports progress.

    Read the fix
Endpoint
One specific address on your server that does one job, like /api/invoices. Each one needs its own safety checks.
Request
A message your browser (or any program) sends to a server asking for something: 'give me invoice 105' or 'save this profile'.
Production
The real, live version of your app that customers use, as opposed to the copy on your laptop.
Serverless function
A piece of server code that starts for each request and stops soon after. You pay per use, and it has time and size limits.
API
The part of an app that other programs talk to. Your app's pages ask its API for data, like a waiter taking orders to a kitchen.
Response
The server's reply to a request: the data, plus a status code saying whether it worked.

All 62 terms in the glossary