ruan
ruan2mo ago

How to use cron?

I have this test repo on deno deploy:
import express from 'express'
import { cron } from "https://deno.land/x/deno_cron/cron.ts";
const app = express()

app.listen(3001, () =>
{
console.log('\u{1F680} API running!')
})

cron("*/60 * * * * *", () => {
console.log('ok');
});
import express from 'express'
import { cron } from "https://deno.land/x/deno_cron/cron.ts";
const app = express()

app.listen(3001, () =>
{
console.log('\u{1F680} API running!')
})

cron("*/60 * * * * *", () => {
console.log('ok');
});
It does print API running but not the console log on the cron lambda, why is it not getting called?
5 Replies
marvinh.
marvinh.2mo ago
Cron is built right into Deno as Deno.cron, see https://docs.deno.com/deploy/kv/manual/cron/
ruan
ruanOP2mo ago
it only support the Deno.cron?
marvinh.
marvinh.2mo ago
I don't understand the question. Can you rephrase that?
zamfofex
zamfofex2mo ago
I imagine they are asking if Deno Deploy only supports Deno.cron and not the package they brought up.
marvinh.
marvinh.2mo ago
Right, I'm not familiar by with that particular library. It's not created by us and was last updated around when the very first Deno 1.0 release was made. Might also be that this library never worked, but was a work in progress project by someone

Did you find this page helpful?