You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
wrangler dev assumes it's running in an interactive environment, which is not always true. For example, running on Github codespaces, it's in a remote docker image. The way other frameworks work is they open the local port and codespaces detects that and magically port forwards and gives you a URL to use. E.g. I can run npm run serve on a Vue project, it opens https://localhost:8080 and then access that on my browser via a URL like https://my-project-xxv4q6php6vw-8080.githubpreview.dev over port 80.
It doesn't work with wrangler though, because it tries to pop up the browser with xdg-open and fails hard when that doesn't work the process dies.
$ npx wrangler pages dev ./dist
Compiling worker to "/tmp/functionsWorker.js"...
Compiled Worker successfully.
Serving at http://127.0.0.1:8788/
/workspaces/eth-registrar/app/web/node_modules/wrangler/wrangler-dist/cli.js:27072
throw ex;
^
Error: spawn xdg-open ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477: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:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'http://127.0.0.1:8788/' ]
}
💁 Opened a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&state=eEWRL1p2O5gb5h2g-hG9sg&code_challenge=4zwFTMKwKcQXVIsonmhZ_al7GQGfU84DRgEUbv13eiQ&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread+user%3Aread+workers%3Awrite+workers_kv%3Awrite+workers_routes%3Awrite+workers_scripts%3Awrite+workers_tail%3Aread+zone%3Aread+offline_access
Error: Failed to receive authorization code from local HTTP server. Please run `wrangler login` again. If the error persists, consider reporting the issue through `wrangler report`.
And codespaces does port forward, but process fails with Failed to receive authorization code from local HTTP server before you can actually enter the url in your local browser.
regarding opening the browser, that was fixed in cloudflare/workers-sdk#211. We'll do a publish next week that includes that fix, or you could try with wrangler@alpha.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
🐛 Bug report
Describe the bug
wrangler dev assumes it's running in an interactive environment, which is not always true. For example, running on Github codespaces, it's in a remote docker image. The way other frameworks work is they open the local port and codespaces detects that and magically port forwards and gives you a URL to use. E.g. I can run npm run serve on a Vue project, it opens https://localhost:8080 and then access that on my browser via a URL like https://my-project-xxv4q6php6vw-8080.githubpreview.dev over port 80.
It doesn't work with wrangler though, because it tries to pop up the browser with
xdg-open
and fails hard when that doesn't work the process dies.Reproduce the bug
A list of steps to reproduce the bug.
npx wrangler pages dev <your output dir>
Expected behavior
npx wrangler pages dev <your output dir>
Environment and versions
Fill out the following information about your environment.
uname -a Linux codespaces_7ecb11 5.4.0-1063-azure #66~18.04.1-Ubuntu SMP Thu Oct 21 09:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
wrangler -V
:$ npx wrangler -v 0.0.7
node -v
: v16.9.1wrangler.toml
: none.NOTE: This is pretty specific to Github code spaces, but other frameworks 'just work'. It would be great if wrangler did too.
The text was updated successfully, but these errors were encountered: