charmbracelet / vhs

Your CLI home video recorder 📼
MIT License
14.79k stars 248 forks source link

panic: Get "http://127.0.0.1:63299/json/version": dial tcp 127.0.0.1:63299: connect: connection refused #232

Open brneor opened 1 year ago

brneor commented 1 year ago

Tried to follow the tutorial and got this error. I'm on WSL Fedora 37, installed vhs and ttyd trough brew. ttyd is working fine.

panic: Get "http://127.0.0.1:63299/json/version": dial tcp 127.0.0.1:63299: connect: connection refused

goroutine 1 [running]:
github.com/go-rod/rod/lib/utils.glob..func2({0xdf2b40?, 0xc000467110?})
    github.com/go-rod/rod@v0.112.0/lib/utils/utils.go:60 +0x25
github.com/go-rod/rod/lib/utils.E(...)
    github.com/go-rod/rod@v0.112.0/lib/utils/utils.go:66
github.com/go-rod/rod/lib/launcher.(*Launcher).MustLaunch(0xc000197030?)
    github.com/go-rod/rod@v0.112.0/lib/launcher/launcher.go:351 +0x67
main.New()
    github.com/charmbracelet/vhs/vhs.go:91 +0x2e5
main.Evaluate({0x1481120, 0xc000426b00}, {0xc0001af500, 0x923}, {0x147cbc0, 0xc000014018}, {0xc0005bfcd0, 0x1, 0x0?})
    github.com/charmbracelet/vhs/evaluator.go:25 +0x1a5
main.glob..func1(0x1a6c260, {0x1ac0210, 0x0, 0x0?})
    github.com/charmbracelet/vhs/main.go:67 +0x24a
github.com/spf13/cobra.(*Command).execute(0x1a6c260, {0xc000024230, 0x0, 0x0})
    github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x1a6c260)
    github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
    github.com/spf13/cobra@v1.6.1/command.go:961
main.main()
    github.com/charmbracelet/vhs/main.go:186 +0xf1
taigrr commented 1 year ago

Does it persist after issuing wsl --shutdown? Also, what commands did you run that triggered the issue? I just ran a fresh install and didn't reproduce

brneor commented 1 year ago

@taigrr yep, it persists after wsl --shutdown. The command I ran was vhs < demo.tape after generating the demo file with vhs new demo.tape which ran successfully.

Alex141642 commented 1 year ago

yup, same here

maaslalani commented 1 year ago

This could be potentially related to https://github.com/charmbracelet/vhs/commit/609f95ae7e36cf1a33f37aa1b7edbda6fa7eae40

maaslalani commented 1 year ago

@brneor @Alex141642

go install github.com/charmbracelet/vhs@56e4d7b094f2e9f1b83c9fb634b2bbb1b98697d6

Does this commit (the one before the limiting interface one) solve your problem? If so, we'll probably have to revert the changes.

brneor commented 1 year ago

@maaslalani tried your suggestion, same issue.

caarlos0 commented 1 year ago

you're using linuxbrew on WSL, correct?

can you try disabling the windows firewall and test if the issue persists? 🤔

brneor commented 1 year ago

@caarlos0 still no luck. I want to emphasize that I can use ttyd with no issues. Maybe I can try running ttyd directly in the same way with the same parameters vhs is trying to use to see if I can find something here.

caarlos0 commented 1 year ago

hmmm. could you try the branch from #234?

go install github.com/charmbracelet/vhs@fix

I think it might give us a better error... 🤔

brneor commented 1 year ago
~/temp                                                                                                                    ✘ 2 10:49:12
❯ go install github.com/charmbracelet/vhs@fix
go: downloading github.com/charmbracelet/vhs v0.3.1-0.20230223125810-3177b2c9ac84
go: downloading github.com/caarlos0/env/v6 v6.10.1
go: downloading github.com/agnivade/levenshtein v1.1.1
go: downloading github.com/charmbracelet/glamour v0.5.1-0.20221015050842-c4cd9ed13e4c
go: downloading github.com/charmbracelet/lipgloss v0.6.0
go: downloading github.com/charmbracelet/keygen v0.3.0
go: downloading github.com/charmbracelet/wish v0.7.0
go: downloading github.com/creack/pty v1.1.18
go: downloading github.com/gliderlabs/ssh v0.3.5
go: downloading github.com/go-rod/rod v0.112.2
go: downloading github.com/hashicorp/go-version v1.6.0
go: downloading github.com/mattn/go-isatty v0.0.16
go: downloading github.com/muesli/go-app-paths v0.2.2
go: downloading github.com/muesli/mango-cobra v1.2.0
go: downloading github.com/spf13/cobra v1.6.1
go: downloading github.com/muesli/roff v0.1.0
go: downloading golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d
go: downloading golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
go: downloading github.com/caarlos0/sshmarshal v0.1.0
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading github.com/muesli/reflow v0.3.0
go: downloading github.com/muesli/termenv v0.13.0
go: downloading github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be
go: downloading github.com/yuin/goldmark v1.5.2
go: downloading github.com/yuin/goldmark-emoji v1.0.1
go: downloading github.com/alecthomas/chroma v0.10.0
go: downloading github.com/microcosm-cc/bluemonday v1.0.21
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/ysmood/gson v0.7.3
go: downloading github.com/ysmood/goob v0.4.0
go: downloading github.com/ysmood/leakless v0.8.0
go: downloading golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43
go: downloading github.com/muesli/mango v0.1.0
go: downloading github.com/muesli/mango-pflag v0.1.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/rivo/uniseg v0.4.2
go: downloading github.com/aymanbagabas/go-osc52 v1.2.1
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading golang.org/x/net v0.0.0-20221014081412-f15817d10f9b
go: downloading github.com/dlclark/regexp2 v1.7.0
go: downloading github.com/gorilla/css v1.0.0

~/temp                                                                                                                 1m 35s 10:52:29
❯ ~/go/bin/vhs < demo.tape
Host your GIF on vhs.charm.sh: vhs publish <file>.gif
panic: Get "http://127.0.0.1:63880/json/version": dial tcp 127.0.0.1:63880: connect: connection refused

goroutine 1 [running]:
github.com/go-rod/rod/lib/utils.glob..func2({0xdf7620?, 0xc0000c1800?})
        /home/brenoperes/go/pkg/mod/github.com/go-rod/rod@v0.112.2/lib/utils/utils.go:65 +0x25
github.com/go-rod/rod/lib/utils.E(...)
        /home/brenoperes/go/pkg/mod/github.com/go-rod/rod@v0.112.2/lib/utils/utils.go:71
github.com/go-rod/rod/lib/launcher.(*Launcher).MustLaunch(0xc0004b1340?)
        /home/brenoperes/go/pkg/mod/github.com/go-rod/rod@v0.112.2/lib/launcher/launcher.go:369 +0x67
main.New()
        /home/brenoperes/go/pkg/mod/github.com/charmbracelet/vhs@v0.3.1-0.20230223125810-3177b2c9ac84/vhs.go:96 +0x333
main.Evaluate({0x148aa40, 0xc0000bf480}, {0xc0004c0900, 0x85b}, {0x14864e0, 0xc000014018}, {0xc0005bfca0, 0x1, 0x0?})
        /home/brenoperes/go/pkg/mod/github.com/charmbracelet/vhs@v0.3.1-0.20230223125810-3177b2c9ac84/evaluator.go:25 +0x1d8
main.glob..func1(0x1a7f400, {0x1ad3410, 0x0, 0x0?})
        /home/brenoperes/go/pkg/mod/github.com/charmbracelet/vhs@v0.3.1-0.20230223125810-3177b2c9ac84/main.go:82 +0x33c
github.com/spf13/cobra.(*Command).execute(0x1a7f400, {0xc000024240, 0x0, 0x0})
        /home/brenoperes/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x1a7f400)
        /home/brenoperes/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/brenoperes/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/brenoperes/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:961
main.main()
        /home/brenoperes/go/pkg/mod/github.com/charmbracelet/vhs@v0.3.1-0.20230223125810-3177b2c9ac84/main.go:230 +0xf1

~/temp                                                                                                                    ✘ 2 10:53:57
❯
caarlos0 commented 1 year ago

oh, missed one Must, can you update and try again? Thanks!

caarlos0 commented 1 year ago

btw, that branch was merged, so

go install github.com/charmbracelet/vhs@main
brneor commented 1 year ago
~/temp                                                                                                                        12:25:14
❯ ~/go/bin/vhs < demo.tape
Host your GIF on vhs.charm.sh: vhs publish <file>.gif
could not launch browser: Get "http://127.0.0.1:52975/json/version": dial tcp 127.0.0.1:52975: connect: connection refused
recording failed

Which partially makes sense because there's no browser installed inside my wsl distro. BUT I've set it up in a way that xdg-open https://google.com correctly opens the default browser on my host machine.

caarlos0 commented 1 year ago

hmmm, it doesn't use xdg-open though, it looks for paths in specific places:

https://github.com/go-rod/rod/blob/f5250379003648c7b65b929d51d43f0da67ca88b/lib/launcher/browser.go#L310

but then, this should have failed too: https://github.com/charmbracelet/vhs/blob/19638c02794c3fc5c35a435dd41b7c3848be75d5/vhs.go#L94-L97

so, I'm not sure what's going on. 🤔

brneor commented 1 year ago

@caarlos0 I have indeed a google-chrome bin in my PATH, so maybe this is why this haven't failed.

My google-chrome is a simple bash script that invokes Windows's Chrome.

caarlos0 commented 1 year ago

oh, that explains it: localhost inside wsl != localhost on the host windows.

not sure how we can fix that 🤔

maaslalani commented 1 year ago

Are you able to install a browser in your WSL @brneor, since VHS uses a headless browser it should work.

brneor commented 1 year ago

@caarlos0 even though this is somewhat true, Windows solves this issue with port-forwarding in a way that I can run ttyd inside WSL and access on the host using 127.0.0.1 or localhost.

@maaslalani installed Chromium inside WSL, still seeing the same issue.. 🤔

maaslalani commented 1 year ago

And the path in WSL points to that browser? Rather than your script?

brneor commented 1 year ago

@maaslalani yep!

~                                                                                                                       17:13:13
❯ z temp

~/temp                                                                                                                  17:13:15
❯ xdg-settings get default-web-browser
chromium-browser.desktop

~/temp                                                                                                                  17:13:18
❯ which chromium-browser
/usr/bin/chromium-browser

~/temp                                                                                                                  17:13:25
❯ ~/go/bin/vhs < demo.tape
Host your GIF on vhs.charm.sh: vhs publish <file>.gif
could not launch browser: Get "http://127.0.0.1:53423/json/version": dial tcp 127.0.0.1:53423: connect: connection refused
recording failed
taigrr commented 1 year ago

@brneor I have a windows 11 vm set up with WSL. Would like more information on your exact fedora 37 install. Are you in the charm discord? If you can, ping me @ WaRPTuX in #help

caarlos0 commented 1 year ago

thanks for jumping in @taigrr , feel free to ping me as well if I can help with anything 🫶

brneor commented 1 year ago

@taigrr I'm not on charm discord yet, I'll look into that. What information do you want about my install?

taigrr commented 1 year ago

You have fedora WSL, whereas most people run ubuntu. What was your installation process for fedora? There are about 8 different ways to arrive at a fedora install in wsl. Can you link me to the instructions you followed or describe it? Differences initial setup may result in different network forwarding rules, and exacerbate the issue

brneor commented 1 year ago

@taigrr I installed by grabbing the rootfs from Fedora Container Base and imported the tar as a WSL distro. It was something very similar to what is described in this article, although I'm not sure it was exactly the same. One of the diverging points is the tutorial I followed instructed me to install wslu too.

taigrr commented 1 year ago

Ah. I apologize, apparently my vm doesn't support nested virtualization and I'm stuck to using wslv1 not v2 so fedora is unsupported. have to tag @caarlos0 back in.