Better debugging for Cloudflare Workers, now with breakpoints
Nov 28, 2023Adam Murray, Brendan Coll

Summary
This post introduces and details the implementation of breakpoint debugging for Cloudflare Workers within the `workerd` runtime. It explains how the Chrome DevTools Protocol (CDP) is utilized, specifically the Debugger domain, and addresses the challenge of suspending execution in an event-driven, single-threaded environment by introducing a dedicated I/O thread for handling CDP messages. It also covers the setup for local debugging using Wrangler with VSCode and WebStorm, and the importance of source maps for mapping generated JavaScript back to original source code.