© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3y ago
zooce

Locally testing a Worker with both a fetch and a scheduled handler

Hey there,

I have a worker that I want to handle both a
fetch
fetch
event and a
scheduled
scheduled
event. Basically I want the
scheduled
scheduled
handler to update a couple of KV stores every so often, while the
fetch
fetch
handler reads from those KV stores to respond to its requests.

The other thing is that both handlers need to access a service binding to another worker. This means to test things out locally I need to run without the
--local
--local
flag (I'm still on wrangler 2 for now), however that seems to mess things up with the
--test-scheduled
--test-scheduled
flag.

Anyone know a way around this? Or perhaps just a better way to do this?
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Error: Handler does not export a fetch() for scheduled worker locally
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
Testing worker locally with an existing project
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Trying to fetch a worker endpoint inside a scheduled trigger
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3w ago
Scheduled worker gets an error in production, not locally
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago