cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

Scheduled Handler and Cron Triggers docs have conflicting method signature

Open thomasgauvin opened this issue 6 months ago • 0 comments

Example URL(s)

https://developers.cloudflare.com/workers/configuration/cron-triggers/ https://developers.cloudflare.com/workers/runtime-apis/handlers/scheduled/

Actual Behavior

Cron Triggers docs and scheduled handlers docs define different method signatures and types for the scheduled handler.

Cron Triggers defines it as interface Env {} export default { async scheduled( controller: ScheduledController, env: Env, ctx: ExecutionContext, ) { console.log("cron processed"); }, };

Scheduled handlers defines it as export default { async scheduled(event, env, ctx) { ctx.waitUntil(doSomeTaskOnASchedule()); }, };

Linting complains when using Scheduled handlers types, but I can't confirm whether it's correct or not.

Expected Behavior

The docs do not present conflicts in APIs

Additional information

No response

thomasgauvin avatar Mar 30 '25 02:03 thomasgauvin