A sleeping Render web service cannot wake itself from code running inside that same service. If the process is asleep, timers and in-process jobs are also asleep.
Working automatic options:
- Keep the service always-on by using a paid Render instance.
- Ping it from an external scheduler (GitHub Actions, Render Cron Job, UptimeRobot, etc.).
- Run a separate worker/cron process that pings your web service.
This API exposes a lightweight health endpoint for keepalive probes:
GET /healthzGET /health(redirects to/healthz)
Use this endpoint for all keepalive traffic.
Workflow file: .github/workflows/render-keepalive.yml
Setup:
- Open
Settings -> Secrets and variables -> Actionsin GitHub. - Add secret
RENDER_BACKEND_URL. - Set it to either:
https://your-service-name.onrender.com- or
https://your-service-name.onrender.com/healthz
The workflow runs every 5 minutes and pings /healthz.
A keepalive worker script is available at scripts/keepalive-worker.js.
Run locally:
KEEPALIVE_URL=https://your-service-name.onrender.com npm run keepalive:workerEnvironment variables:
KEEPALIVE_URL(required)KEEPALIVE_INTERVAL_MS(optional, default240000)KEEPALIVE_TIMEOUT_MS(optional, default10000)
Recommended on Render:
- Create a separate Background Worker or Cron Job service.
- Point it to this same repo.
- Start command:
npm run keepalive:worker - Set env
KEEPALIVE_URL=https://your-service-name.onrender.com
This keeps the web service warm more reliably than in-process timers.