How to run Cron Jobs from a Nextjs app
tarkbyte
FREEOP

a year ago

Hello, I am trying to run a cron job which is in a cron folder of my nextjs app, I have a service with the repo added to railway, also a postgres db.

Afaik, to run a cron job I need to set a cron schedule and a start command but this will not override nextjs start command?

2 Replies

tarkbyte
FREEOP

a year ago

fab0d2ac-db2e-4cce-baae-a87c3fc97280


mikexie360
PRO

a year ago

I think the railway.app cron job is for executing a service.

So the railway.app cron job will turn on the service and then shut the service when it’s done.

You can have a separate service with a cron job that calls an endpoint to your next js app.

But what I did was just use python fastapi’s built in cron job to do the cron job instead of relying on railway.app

But maybe next js has their own library for a cron job


Loading...