When Cron Jobs Return 200 but Fetches Fail

Zusammenfassung

Pixel shares a DEV Community post examining monitoring gaps in Upwork Scout, a job-alert SaaS that scans Upwork every 15 minutes, and VoiceDash. It shows how Promise.allSettled can hide failed fetches behind successful HTTP responses, why console logs are not monitoring, and why alerting on silence matters.

DEV Community

My Cron Job Returns 200 When Every Fetch Fails

I wrote a post on my site about monitoring a small product without an ops team. Its strongest claim is that the worst failures are silent: no exception, no 500, just something that should have happened and did not. The layer I told people to build first was "alert on silence". Then I did what I did with my kill switch post and opened my own repos to see if I follow my own advice. Two products: Upwork Scout, a job-alert SaaS that scans Upwork on a cron and emails matches, and VoiceDash, a white-label portal for Retell voice agents. The short version: I do not. Layer one: an error reporter. I have none. The post says every client needs a crash and error reporter from the first release, tagged with version and platform. I searched both repos for Sentry, Crashlytics, PostHog, Axiom, anything. Zero hits. What I have instead is console.error. Six calls in Upwork Scout, twenty in VoiceDash. They go to Vercel's function logs, which I read when something already feels wrong. That is not monitoring. That is a diary. I am not going to pretend this is a hard problem. It is an afternoon. The more interesting findings were in the layers below, because those are the ones where adding Sentry would not have helped at all. The cron job that succeeds at nothing Upwork Scout's whole product is one route: /api/cron/scan. Something pings it every 15 minutes, it fetches new jobs per category, scores them against each user's profile with Claude, and emails the good ones. Here is how it fetches: const results = await Promise.allSettled(
activeCats.map((c) => fetchUpworkJobs(c.query, PER_RUN_LIMIT)),
);
results.forEach((r, i) => {
if (r.status === "fulfilled") {
billed += r.value.billedItems;
fetched.push({ cat: activeCats[i].id, jobs: r.value.jobs });
} else {
console.error(fetch failed for ${activeCats[i].id}:, r.reason);
}
});
Promise.allSettled is the right call here. One broken category should not kill the run for everyone else. The problem is what happens when every category fails. Say the scraping token expires. fetchUpworkJobs throws apify ...: 401 for every category, each one gets a console.error, and the run carries on with zero jobs. Zero jobs means zero matches, zero emails, and then: await metaCol().doc("scan").set({ lastRunAt: now, lastStats: stats }, { merge: true });
return NextResponse.json({ ok: true, ...stats });
ok: true, HTTP 200. The pinger sees a 200 and is happy. If it is the GitHub Actions workflow in the repo, that workflow only fails when the status is not 200, so the run goes green. Every 15 minutes, forever, a green check on a product that has stopped doing its one job. The post calls this a wrong-but-working failure. I built one and gave it a checkmark. There is a smaller version of the same thing in the AI scorer. If the Claude call fails, scoreJobFit logs and returns null, and the route treats a missing verdict as "filters only": // Gate on threshold only when we actually have a verdict; AI failure => filters-only.
if (verdict && verdict.score < matching.threshold) {
That is a deliberate degradation and I still think it is the right one: a user would rather get an unscored alert than none. But the post says to log the decision, not just the outcome, so a correct fallback does not look like a bug. The route counts aiScored but not "AI failed, sent anyway". If the model call broke for a day, the stats would show fewer scores and more alerts, and nothing would say why. The heartbeat nobody reads That meta/scan write is the part that made me laugh. Every successful run stores lastRunAt and the run's stats in Firestore. That is a heartbeat. It is exactly what the post tells you to build. I grepped for anything that reads it. Nothing. No admin page, no check, no script. It is a heartbeat written into a drawer. And the run that never starts writes nothing at all. If the pinger stops, there is no error anywhere, because no code ran. That is the case the heartbeat exists for, and it only works if some...
When Cron Jobs Return 200 but Fetches Fail
Powered by Readybot.io

Das Neueste von Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …