Kotkoroid
Kotkoroid•6mo ago

CRON on Deploy

Hey, is CRON working fine on Deploy? Maybe I don't know how to use it. I have created a file cron.ts a put there: Deno.cron('Run once a minute', '* * * * *', () => { console.log('Hello, cron!'); }); It deployed on prod but there is nothing in CRON tab.
7 Replies
amg
amg•2d ago
Hi, I have teh same problem, did you found a solution?
fro.profesional
fro.profesional•10h ago
You have to import it from the entrypoint
telesto🌛
telesto🌛•9h ago
I did so in my main.ts
import './utils/cron.ts';
import './utils/cron.ts';
but this doesn't show up as running, in logs on deploy it says
Crons are not supported for preview deployments. Cron jobs will not be executed in this context.
Which I don't understand as it isn't a preview deployment?
fro.profesional
fro.profesional•9h ago
Did u deployed with —prod flag or promoted a preview deployment to prod?
telesto🌛
telesto🌛•9h ago
Promoted one to prod 👀 I think that did it, it now shows up in the cron tab
amg
amg•9h ago
Yes, if you deploy with —prod flag you get the cron I think is related with the early version access Have you got this option enabled in the us? UI*
fro.profesional
fro.profesional•7h ago
I think is because the way it works, its on deploy deno deploy scan for usages of deno cron, but that doesn’t seems to happend when promoting deployments

Did you find this page helpful?