Scheduling tasks
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
is it possible implement a scheduler in nextjs that executes a task daily without defining a cron job in the
vercel.json file, ensuring it starts running when the application launches?17 Replies
Nope
If you’re deploying to serverless infrastructure like vercel
This is simply not possible
Without using an external scheduler
At a high level, your app “launches†whenever someone visits it, this is how serverless works
Then it spins down when there’s no more activity
So it’s not possible to have a scheduler running in the background
Vercel cron jobs can be a decent solution for simple stuff
Sloth bearOP
If I deploy my app on a VPS, rather than serverless infrastructure. Would it be possible to run a background scheduler for tasks.
Yep
Sloth bearOP
How?
Cause if it possible I can test it on my local machine seeing that it will run locally also on a VPS
Cause if it possible I can test it on my local machine seeing that it will run locally also on a VPS
Uhhh
There’s tons of ways
Just Google for solutions
Scheduling is a non trivial problem
Yes you can test locally
Sloth bearOP
I tried, and I found results correlated just with vercel