BlogScheduling

My node-cron job never runs after deploy.

A timer inside your app needs the app to be running, and an idle app sleeps. Move the work into a route and schedule that route.

How the Agent API works
  • What happenedThe app was asleep
  • The fixA scheduled job calls a route
  • It wakes the appSo nothing has to stay running
  • On every planThree jobs per app

The short answer

A scheduler in your own code, such as node-cron, setInterval, schedule or APScheduler, only works while the app is running. Antideploy scales an idle app to zero, so the timer stops with it and never fires. Move the work into a route, and ask your agent to schedule a call to that route. Antideploy calls it on your schedule and wakes the app.

How to tell

  • Your code has node-cron, cron, node-schedule, setInterval or similar. Antideploy flags a scheduler inside the process before you deploy, and says the timer will not fire.
  • A nightly job never ran. The app was asleep at that time.

How to fix it

  1. Move the work into a route

    For example, POST /api/cron/nightly does what your timer did.

  2. Ask your agent to schedule it

    Say: "Run /api/cron/nightly every day at 3am UTC." Antideploy sends a request to that path on your schedule and wakes the app if it is asleep.

  3. Protect the route

    Anyone can send the cron header, so a route that does real work should check a secret of your own.

See how to run a scheduled job for the code and the rules.

01Before you commit

Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

  1. No background workers

    Only the web process runs. A queue consumer or a loop inside the app will not stay alive. Use a cron job to call a path on a schedule, or a webhook.

  2. Apps sleep when idle

    On every plan, an app nobody is using goes to sleep and the next visit wakes it. The first request took 2.9 to 13.9 seconds in our measurements, depending on the stack. There are no always-on workers, so use a cron job or a webhook for background work.

02Questions

Scheduler questions, answered.

Anything else? Write to us and a person answers.

support@antideploy.com
How often can a job run?

At most every five minutes, with three jobs per app on every plan. Each run is given up after 60 seconds.

Does setInterval work while people are using the app?

Yes, while the app is awake. It stops when the app sleeps, and it starts again from zero when the app wakes, so it is not a schedule you can rely on.

What about a background worker?

Only the web process runs today, so a queue consumer will not stay alive. Use a scheduled job, or a webhook.

Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

Start from GitHub or a folder
Prompt copied Paste it into Claude Code, Codex or Cursor and press Enter.