Test a cron trigger locally

local dev

// what it does

Exposes a /__scheduled route in local dev so you can fire your scheduled() handler on demand instead of waiting for the real cron. Pass ?cron=... to simulate a specific schedule when your Worker branches on event.cron.

// shell

$ wrangler dev --test-scheduled
$ curl 'http://localhost:8787/__scheduled?cron=*+*+*+*+*'

// gotcha

The endpoint only exists with --test-scheduled in local dev; requesting / won't run scheduled(). The cron string must be URL-encoded — spaces become +.