# My node-cron job never runs after deploy.

URL: https://antideploy.com/blog/node-cron-job-never-runs

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.

## At a glance

- **What happened**: The app was asleep
- **The fix**: A scheduled job calls a route
- **It wakes the app**: So nothing has to stay running
- **On every plan**: Three jobs per app

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## 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](https://antideploy.com/blog/how-to-run-a-scheduled-job-on-your-app) for the code and the rules.

## 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.

### 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.

### 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.

## Scheduler questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto: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.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [How to run a scheduled job on your app](https://antideploy.com/blog/how-to-run-a-scheduled-job-on-your-app): Write a route, schedule it. Antideploy calls it on a cron schedule and wakes the app if it sleeps.
- [Why does my app work on localhost but not online?](https://antideploy.com/blog/why-does-my-app-work-on-localhost-but-not-online): Nine common reasons, how to check each one, and how to fix it.
- [My app is slow on the first visit](https://antideploy.com/blog/my-app-is-slow-on-the-first-visit): Apps sleep when idle, so the first request takes seconds. Measured times and what helps.

- [Cron jobs](https://antideploy.com/platform/cron-jobs)
- [Hosting](https://antideploy.com/platform/hosting)
- [Logs and monitoring](https://antideploy.com/platform/logs-and-monitoring)

Facts on this page were checked against the live platform on 7 October 2026.

## 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.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
