Skip to content

🐛 BUG: Scheduled Handler not found in Local Dev #5548

Description

@helloimalastair

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.48.0

What version of Node are you using?

21.7.2

What operating system and version are you using?

macOS Sonoma 14.4.1

Describe the Bug

Observed behavior

When developing a Worker with a scheduled handler, invoking the handler via http://localhost:8787/cdn-cgi/mf/scheduled throws the following error:

✘ [ERROR] Received a ScheduledEvent but we lack a handler for ScheduledEvents (a.k.a. Cron Triggers). Did you remember to export a scheduled() function?

Expected behavior

scheduled handler should be detected and executed.

Steps to reproduce

Please provide the following:

  • Worker Code
export default {
	scheduled() {
		console.log("Hey!");
	}
}
  • wrangler.json:
{
	"name": "cron-test",
	"main": "index.js",
	"compatibility_date": "2024-04-07",
	"triggers": {
		"crons": ["0 0 * * * * *"]
	}
}
  • Command to start:
wrangler dev -j
  • curl command:
$ curl http://localhost:8787/cdn-cgi/mf/scheduled
exception%

Please provide any relevant error logs

$ wrangler dev -j

 ⛅️ wrangler 3.48.0
-------------------
⎔ Starting local server...
▲ [WARNING] Miniflare 3 does not support CRON triggers yet, ignoring...


[wrangler:inf] Ready on http://localhost:8787
✘ [ERROR] Received a ScheduledEvent but we lack a handler for ScheduledEvents (a.k.a. Cron Triggers). Did you remember to export a scheduled() function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions