Skip to content

Handlers

Methods on the module Worker's exported object.

ts
export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
    return new Response("ok");
  },
  async scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext): Promise<void> {},
  async queue(batch: MessageBatch, env: Env, ctx: ExecutionContext): Promise<void> {},
} satisfies ExportedHandler<Env>;

Durable Object alarm() lives on the DO class, not the default export. See DO Alarms.

Compatibility

TopicCloudflareopen-compute
fetch, scheduled, and queue arguments and return valuesYes — HandlersYes
ctx.waitUntil, ctx.passThroughOnExceptionYesFollow workerd
Email handler / Tail handlerYesNot provided
Cron triggerHosted CronUTC five-field; misfire projects at most the latest slot in grace — Cron Triggers
Queue deliveryGlobal queue semanticsSingle-node at-least-once, not global FIFO
triggers.crons / queue-consumer array in the project fileWranglerNot allowed; platform deployment metadata accepts crons and queue_consumers