JoeAO
JoeAO•9mo ago

Cron BackoffSchedule 502

When testing the sample code from the Deno Deploy docs in the Deno playgroud, I'm getting a 502 bad gateway error. To reproduce: 1. Copy code from https://docs.deno.com/deploy/kv/manual/cron#retrying-failed-runs 2. Paste code to https://dash.deno.com/tutorial/tutorial-cron 3. Save and Deploy The logs say:
TypeError: Deno.cron requires a single handler
at Object.cron (ext:deno_cron/01_cron.ts:67:13)
at file:///src/main.ts:1:6
TypeError: Deno.cron requires a single handler
at Object.cron (ext:deno_cron/01_cron.ts:67:13)
at file:///src/main.ts:1:6
Also getting this issue on my project, but this is a simple way to reproduce. Couldn't find any mentioin of it on Github or in here. Shoud I open an issue, or am I doing something wrong?
3 Replies
Deno AI Helper
Deno AI Helper•9mo ago
It seems like you're encountering an issue with the Deno.cron functionality. The error message you're seeing indicates that Deno.cron expects a single handler function, but it's possible that the way the code is being used might not be matching the expected signature. According to the documentation, the Deno.cron function should be used with three arguments: 1. A human-readable name for the cron task. 2. A cron schedule string or JavaScript object that defines a schedule on which the cron job will run. 3. A function to be executed on the given schedule. Here's an example from the documentation:
Deno.cron("Retry example", "* * * * *", () => {
throw new Error("Deno.cron will retry this three times, to no avail!");
}, {
backoffSchedule: [1000, 5000, 10000],
});
Deno.cron("Retry example", "* * * * *", () => {
throw new Error("Deno.cron will retry this three times, to no avail!");
}, {
backoffSchedule: [1000, 5000, 10000],
});
Make sure that your code follows this structure. If you're still encountering the issue, it could be a bug or a limitation within the Deno playground environment. Since the Deno.cron functionality is designed to be used within the context of Deno Deploy, it's possible that the playground may not fully support all features or may have different constraints. If you've verified that your code matches the expected usage and you're still facing the issue, it might be worth reaching out on the official Deno Discord or opening an issue on the Deno GitHub repository for further assistance. The Deno community and maintainers can provide more context and help you troubleshoot the problem. 🦕
Deno AI Helper
Deno AI Helper•9mo ago
🦕 Oops! Can you pinpoint where I went wrong to help me improve? 📈
JoeAO
JoeAOOP•9mo ago
The documented code is experiencing this issue https://dash.deno.com/playground/clean-zebra-64

Did you find this page helpful?