angelcapitalp
angelcapitalp4mo ago

Deno.cron error

Hi I keep having an error on deno deploy where my cron job doesn't seem to execute well in production. I have server.ts where I import the cron job script:
import "./mongoTestCron.ts";
import "./mongoTestCron.ts";
and inside of the mongoTestCron.ts I have:
Deno.cron("processDocumentsEveryMinute", "* * * * *", async () => {
await checkAndProcessDocuments();
});
Deno.cron("processDocumentsEveryMinute", "* * * * *", async () => {
await checkAndProcessDocuments();
});
Works well in local, on deno deploy I get errors: rror processing document: Error: HTTP error! status: 508 at checkAndProcessDocuments (file:///src/mongoTestCron.ts:51:17) at eventLoopTick (ext:core/01_core.js:168:7) at async file:///src/mongoTestCron.ts:87:3 at async ext:deno_cron/01_cron.ts:102:42
1 Reply
Deno AI Helper
Deno AI Helper4mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided in your message, there are no obvious syntax errors or mistakes in the code snippets you've shared. The error message you're encountering, "HTTP error! status: 508," suggests that there might be an issue with an HTTP request that is being made within the checkAndProcessDocuments function. The status code 508 indicates a "Loop Detected" error, which is not a common HTTP status code and might be specific to the server or service you are interacting with. Since this is not directly related to Deno's functionality and I cannot provide debugging advice outside of what is directly found in your message, I recommend reviewing the checkAndProcessDocuments function to ensure that there are no infinite loops or recursive calls that could be causing this error. Additionally, check the service or API you are interacting with to see if there are any known issues or limitations that could lead to a 508 error. Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of the advice given. If the issue persists, you may need to investigate further or reach out to the support for the service you're using in conjunction with your Deno application.