Cron: guard missing expr in schedule parsing

This commit is contained in:
Vignesh Natarajan
2026-02-21 20:18:11 -08:00
parent eea0a68199
commit 961bde27fe
6 changed files with 45 additions and 2 deletions

View File

@@ -41,7 +41,11 @@ export function computeNextRunAtMs(schedule: CronSchedule, nowMs: number): numbe
return anchor + steps * everyMs;
}
const expr = schedule.expr.trim();
const exprSource = (schedule as { expr?: unknown }).expr;
if (typeof exprSource !== "string") {
throw new Error("invalid cron schedule: expr is required");
}
const expr = exprSource.trim();
if (!expr) {
return undefined;
}