Skip to content

Scheduled Handler and Cron Triggers docs have conflicting method signature #21241

Description

@thomasgauvin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions