July 10, 2026backendSource: claude-session-abc123

How to debug Cloudflare Workers locally

A reliable method for setting up local Wrangler dev and inspecting requests.

Problem

Testing Cloudflare Workers in production is slow. You want fast feedback loops with wrangler dev.

Solution

  1. Install Wrangler globally:
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
npm install -g wrangler
  1. Authenticate once:
wrangler login
  1. Run the local dev server:
wrangler dev --local
  1. Add console.log() statements in your Worker. They appear in the terminal instantly.

Pro tip

Use wrangler tail to stream production logs when you need to inspect live traffic without redeploying.

← Back to all learnings