workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Rust workers' dev mode fails with option open Devtools if Chrome not installed, 100% CPU usage

Open robmv opened this issue 9 months ago • 0 comments

After starting the dev mode of the Rust worker example, the option [d] open Devtools fails with the error:

.../node_modules/wrangler/wrangler-dist/cli.js:29573
            throw a;
            ^

Error: spawn google-chrome ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn google-chrome',
  path: 'google-chrome',
  spawnargs: [
    'https://devtools.devprod.cloudflare.dev/js_app?theme=systemPreferred&ws=127.0.0.1%3A9229%2Fws&domain=worker-rust&debugger=true'
  ]
}

This happens because google-chrome isn't installed (I use Fedora packaged Chromium if I need to test Chrome in my development machine, no need for Chrome specifically).

The problem is that after this, the developer mode crashes and leave a workerd process stuck at 100% on a single core. A manual kill of the process is needed:

Screenshot from 2024-05-01 20-11-56

Note: if the Devtools requires Chrome and isn't compatible with Firefox, at least try optionally with chromium-browser if Chrome isn't found.

robmv avatar May 02 '24 00:05 robmv