CRON Job Issue working fine in local
Unanswered
shyamtawli posted this in #help-forum
Code attached in the image.
So all the things are working fine locally,
urlStatus are getting called url are sent to index and updates status are stored in db.
But when I deploy it and call run from cron jobs and check logs after the console logging "Filter Data sent from Indexing" nothing is working. No more console log on logs, no update on db.
What is the problem? What I am doing wrong
So all the things are working fine locally,
urlStatus are getting called url are sent to index and updates status are stored in db.
But when I deploy it and call run from cron jobs and check logs after the console logging "Filter Data sent from Indexing" nothing is working. No more console log on logs, no update on db.
What is the problem? What I am doing wrong
21 Replies
American Chinchilla
Are you deploying to firebase?
If so, it's serverless so it'll shut down after no requests to it for a bit
Deployed on Vercel
Using firebase for DB
Yeah so serverless. You can’t have cron jobs baked into your serverless functions.
Cron jobs at their core is a process that stays alive to run something at regular intervals. But with serverless when something is not being used (cron jobs don’t count as usage in this context) it scales back down to 0 or “off”
American Chinchilla
^ this
refer to the vercel cron job documentation for how to make cron jobs on vercel. https://vercel.com/docs/cron-jobs
@joulev refer to the vercel cron job documentation for how to make cron jobs on vercel. <https://vercel.com/docs/cron-jobs>
What he said 😂 sorry don’t know much about vercel for hosting
@Jboncz Cron jobs at their core is a process that stays alive to run something at regular intervals. But with serverless when something is not being used (cron jobs don’t count as usage in this context) it scales back down to 0 or “off”
So how to fix it? I am not able to solve it from the last 2 days 🥲😭
anyone @Jboncz @American Chinchilla please help
American Chinchilla
you can use something like vercel cron, like what joulev mentioned, or deploy it to a non-serverless configuration
I am using vercel cron, but the db function is like getuserserviceaccount not getting called.
American Chinchilla
are you on hobby plan?
if so i think you're limited to 1 invocation a day
no pro plan and the api route is getting called by after sometimes is doesn't work
See image above, no console log after this
is it a firebase issue I think
Prairie yellowjacket
do you have a schedule in your vercel.json?
yes