shiichan

Wrangler's Workflows commands all work in local dev now!

Hey there, it's Shiichan! Today I found a nice little update that makes local development a bit smoother, so let me share it with you.

Cloudflare Changelog developers.cloudflare.com

What was announced?

This one comes from Cloudflare's Changelog. All the wrangler workflows commands that operate on Workflows now accept a --local flag. That means you can point these commands at the Workflows running in your local wrangler dev session instead of the production API.

The supported operations include listing and triggering Workflows, plus listing, pausing, resuming, restarting, terminating, and sending events to instances. So pretty much everything you'd want to do with Workflows on Workers can now be done locally.

The story so far

Until now, the wrangler workflows commands were built to hit the production API. That made it a little awkward to poke at a Workflow you were developing locally straight from the CLI. You'd have your Workflow running locally, but checking its state took a different path.

What changes

Just add --local and the same commands target your local wrangler dev session. You can trigger a Workflow you're building, list its instances, and even pause or terminate them, all right on your machine. Being able to run your dev loop without touching production is a quietly satisfying win.

Dive Deep

Alongside --local, the commands also accept a --port flag. --port lets you target a specific wrangler dev session, and it defaults to 8787. So even if you have several sessions running, you can aim at the right port.

wrangler workflows {command} --local --port 8787

For more on how to use it, check out the official Workflows local development guide.

Wrap-up

  • Every wrangler workflows command now supports the --local flag
  • List, trigger, and pause/resume/restart/terminate instances plus send events, all locally
  • Use --port to target a specific wrangler dev session (defaults to 8787)

If you're developing Workflows locally, this makes your dev loop a lot easier to spin. It should land nicely for anyone who likes to keep things on their own machine!