bracey.vim icon indicating copy to clipboard operation
bracey.vim copied to clipboard

Remote connections don’t work

Open adamavenir opened this issue 6 years ago • 3 comments

I’m trying to debug why remote connections aren’t working for me in bracey. In the process, I’ve discovered at least one bug (#12) which got me a little farther.

I’m going to share what I learn while attempting to debug here.

For reference, I’m using the following config:

let g:bracey_auto_start_browser=0                                
let g:bracey_server_allow_remote_connections=1                   
let g:bracey_server_port=8080                           

When starting :Bracey, I get:

starting server with args "['node', 'launch.js', '--port', '8080', 
'--allow-remote-web']"

--allow-remote-web didn't show up in the args until fixing #12, so that's some progress.

I can confirm that bracey' s node server is running and listening on 8080:

$ sudo netstat -an | grep LISTEN | grep 8080 
tcp6       0      0 :::8080                 :::*                    LISTEN      7246/node

When visiting http://[ip-address]:8080, I note in my browser dev tools that it performs a 302 redirect and the address changes to http://[ip-address]:8080/projectfolder/index.html and then fails.

When I look at vim, I note an error message:

bracey error: <urlopen error [Errno 111] Connection refused>

I check netstat again and find that it's no longer listening.

I check Bracey’s default configured log path and there is nothing of note logged there.

So at some point, it's hitting that redirect and then failing. I'll probably keep digging at this as I have time.

adamavenir avatar Nov 04 '19 23:11 adamavenir

Thanks for looking in to this! I don't have much time to work on this project but I fixed up the logging to include error output. If you pull master you should get those changes.

Feel free to submit a PR

turbio avatar Nov 07 '19 07:11 turbio

Thanks @turbio. Continuing to make notes here as I poke at this in my spare time.

I note two error messages:

The first doesn't really seem to be related at all. I get this when I exit vim after bracey has been started:

bracey error: <urlopen error [Errno 111] Connection refused> 


Error detected while processing function bracey#stop[1]..bracey#stopServer:                       
line    2:                                                                                        
Traceback (most recent call last):                                                                
  File "<string>", line 1, in <module>                                                            
  File "/home/adam/.vim/bundle/bracey.vim/script/bracey.py", line 71, in stopServer               
    bracey_server_process.terminate()                                                             
  File "/usr/lib/python3.6/subprocess.py", line 1605, in terminate                                
    self.send_signal(signal.SIGTERM)                                                              
  File "/usr/lib/python3.6/subprocess.py", line 1600, in send_signal                              
    os.kill(self.pid, sig)                                                                        
ProcessLookupError: [Errno 3] No such process      

The second is what is logged when attempting to open the address via remote browser:

/home/adam/.vim/bundle/bracey.vim/server/node_modules/domutils/lib/manipulation.js:32
        if(elem.children.push(child) !== 1){
                ^

TypeError: Cannot read property 'children' of null
    at Object.exports.appendChild (/home/adam/.vim/bundle/bracey.vim/server/node_modules/domutils/lib/manipulation.js:32:10)
    at HtmlFile.webSrc (/home/adam/.vim/bundle/bracey.vim/server/htmlfile.js:47:22)
    at Server.handleFileRequest (/home/adam/.vim/bundle/bracey.vim/server/server.js:233:21)
    at Server.httpRequest (/home/adam/.vim/bundle/bracey.vim/server/server.js:49:8)
    at Server.emit (events.js:210:5)
    at parserOnIncoming (_http_server.js:742:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)

Feel free to chime in if you have a suggestion of what to investigate based on this. I'll just keep poking at it here and there. I'm a little slow going cos I'm pretty rusty as a developer, and I'm also doing 100% of my development work on an iPad—mostly for the challenge of it :)

adamavenir avatar Nov 14 '19 05:11 adamavenir

This problem was raised a while back. I had a similar situation recently. I download the plugin on my laptop and later on downloaded it on my PC. The first time I was way more attentive on what I was doing but the second time around I forgot to do an important thing which generated the exact same error message.

Here is what I forgot : image

Eyeofthequeen avatar Sep 03 '20 17:09 Eyeofthequeen