DEV Community

Kacper Zawojski
Kacper Zawojski

Posted on

Payload v4: stricter cron — sloppyRanges is gone

Watch out for this one when upgrading to Payload v4: cron parsing got stricter.

After the Croner bump to v10, the sloppyRanges escape hatch is gone. Stepping in a cron expression now has to be syntactically correct, or you get a TypeError at registration time — instead of it being silently ignored:

- cron: '/10 * * * *'      // missing prefix — throws
+ cron: '*/10 * * * *'

- cron: '5/15 * * * *'     // numeric prefix — throws
+ cron: '5-59/15 * * * *'  // explicit range
Enter fullscreen mode Exit fullscreen mode

This applies everywhere you write a schedule: jobs.autoRun[].cron, schedule.cron, and the --cron flag on the binary. The good news is the failure is loud — a malformed expression that used to quietly never fire now throws on startup, so you find out immediately.

Top comments (0)