Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put breakpoints and debug Cloudflare Workers?

How do I put breakpoints and debug Cloudflare Workers? I've read the Cloudflare "Debugging Workers" guide, and unfortunately, it is not helpful.

It does mention:

Inserting console.log lines throughout your code can help you understand the state of your application in various stages until you reach the desired output.

I am wondering if anyone has figured out how to debug the application more thoroughly instead of console.log, or a workaround to do this.

Thanks

One idea I had was to use a different service (GCP/Firebase cloud functions as a separate runtime / entrypoint which allows me to debug during development, which then helps. However, the Cloudflare environment is more restricted than your average cloud function/lambda (for performance reasons?). Might still be worth doing though.

like image 237
Ben Butterworth Avatar asked Sep 11 '25 23:09

Ben Butterworth


1 Answers

At present (March 2022), breakpoints are not yet supported by Cloudflare Workers. We'd like to support them eventually.

When breakpoints are supported, you'll be able to set them through the devtools UI, which appears when viewing a Worker through the preview UI.

like image 132
Kenton Varda Avatar answered Sep 16 '25 10:09

Kenton Varda