question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Github Codespaces: spawn xdg-open ENOENT on wrangler dev

See original GitHub issue

Really excited about this! I gave this a spin in Github Codespaces and ran into the following:

@irvinebroque ➜ /workspaces/project (main ✗) $ wrangler dev src/worker/index.ts
/usr/local/share/nvm/versions/node/v17.1.0/lib/node_modules/wrangler/wrangler-dist/index_node.js:27064
            throw ex;
            ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:475:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:475:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    'https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=redacted&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20zone%3Aread%20offline_access&state=.....'
  ]
}

Node.js v17.1.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
threepointonecommented, Nov 16, 2021

We definitely want to support environments like github codespaces (and codesandbox, stackblitz, all of them). For one, ee should have a better experience so this doesn’t crash immediately like it does. As a workaround, you can start the command with --local so it runs fully on the machine itself. That said, you might not be able to automate the opening of devtools either. We’ll get better at this. Leaving this issue open until we have a better story.

3reactions
WalshyDevcommented, Nov 20, 2021

Fixing the opening link part is simple, the problem which I’m not sure how should be properly solved is the localhost callback for auth.

What I think is probably easiest is accepting user input to retrieve the callback URL.

Something like:

💁 Opening https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=${CLIENT_ID}&redirect_uri=${CALLBACK_URL}&scope=${SCOPES}&state=${STATE}

Failed to launch browser (spawn xdg-open ENOENT)

Please insert callback URL:
$ http://localhost:8976/oauth/callback?code=${CODE}&scope=${SCOPES}&state=${STATE}

Not ideal but would at least support codespaces, servers, etc to authenticate through OAuth.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: spawn xdg-open ENOENT · Issue #6642 - GitHub
Description of the problem. Could not start service in the codesandbox below, command line threw "Error: spawn xdg-open ENOENT" error. image.
Read more >
Wrangler fails with Error: spawnSync ENOENT on WSL2 #1597
Error: spawnSync /home/glen/.wrangler/bin/wrangler ENOENT at Object.spawnSync (internal/child_process.js:1070:20) at spawnSync (child_process.js:597:24) at ...
Read more >
storefront:hot-proxy spawn xdg-open ENOENT #343 - GitHub
Description When using storefront:hot-proxy inside the docker container it results in the following error: ############ Storefront proxy ...
Read more >
Unable to install wrangler globally inside a Docker container ...
I am trying to install wrangler inside a Docker container using the NPM -g flag. The Node was installed inside the container using...
Read more >
wrangler dev in 11.0 is non-functional when there are ... - GitHub
I have a worker deployed with a very broad/non-specific route, *example.com/* . It handles some generic redirect behavior. I have other workers ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found