Closed Jamesllllllllll closed 9 months ago
I set up a CRON job to check a mocked up data set and send emails based on the results.
I need to work on error handling, they currently cause the link checker to bail out and not send an email.
So CRON jobs will only actually run in full "production" - meaning none of the development deployments (good thing, as it could potentially run & send multiple emails).
Currently the CRON job is set to run hourly for a single username and email me. I will monitor today to see if it's working!
I have a CRON job that runs /api/weeklyCron
set up to take an array of users from the db and in turn calls /api/checkWeekly
for each user.
There was an issue with weeklyCron
not being detected as a serverless function by Vercel. One line of code was required on that endpoint to force Vercel to do so:
export const dynamic = 'force-dynamic'
The checkWeekly
function is a single function that combines /api/checkBeacons
and loops through each link calling /api/checkHeaders
- and finally sends an email through SendGrid when it's complete if there are any warnings or errors for the links.
Next steps: