ruan
ruan4w 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.4w ago
Cron is built right into Deno as Deno.cron, see https://docs.deno.com/deploy/kv/manual/cron/
ruan
ruanOP4w ago
it only support the Deno.cron?
marvinh.
marvinh.4w ago
I don't understand the question. Can you rephrase that?
zamfofex
zamfofex4w ago
I imagine they are asking if Deno Deploy only supports Deno.cron and not the package they brought up.
marvinh.
marvinh.4w 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?