Go-ipfs: Connecting from js-ipfs node or browser over websockets, doesn't work against latest master.

Created on 4 Sep 2017  路  10Comments  路  Source: ipfs/go-ipfs

Version information:

go-ipfs version: 0.4.11-dev-cbd13b611
Repo version: 6
System version: amd64/darwin
Golang version: go1.8.3

Type:

Bug

Severity:

High

Description:

Connecting from js-ipfs node or browser over websockets doesn't work against the latest master. The connection fails with a 403 error.

Steps to reproduce:

  • using go-ipfs master and js-ipfs master
  • add a WS address to go ipfs config and start the go-ipfs node
  • start the js-ipfs node
  • connect to the go-ipfs using a WS multiaddr - jsipfs swarm connect /ip4/0.0.0.0/tcp/<port>/ws/ipfs/QmAddr

Gist with the go-ipfs logs
https://gist.github.com/dryajov/c86c8b9b1bfbd6956e6c9ae2e5aa98a6

regression topiinterop topilibp2p

All 10 comments

@dryajov could you provide us with a way to reproduce the issue? as well as any helpful error messages or info you have

@whyrusleeping on it - doing some troubleshooting to make sure its not my env. Will update with more details ASAP.

Edit:
issue updated with logs and steps to reproduce.

Should be fixed by #4205.

@whyrusleeping @Stebalien I was able to confirm that it works from the command line - I was able to connect over WS. However, the browser is still giving me issues with a 403 response when connecting to the same peer over the same address. I'll continue troubleshooting it, but it should be easy to reproduce by running the example in examples/exchange-files-in-browser in the jp-ipfs repo. To run the sample do:

  • clone the js-ipfs repo
  • cd <js-ipfs-repo>/examples/exchange-files-in-browser && npm install && npm run start
  • navigate to the url printed in the CMD, which should give you the file transfer example interface, use a WS address to connect to a go node

you should get an error message printed on the UI:

Error: Could not dial in any of the transports
    at swarm.transport.dial (https://unpkg.com/[email protected]/dist/index.min.js:211:5590)
    at dialer.dialMany (https://unpkg.com/[email protected]/dist/index.min.js:211:11995)
    at map (https://unpkg.com/[email protected]/dist/index.min.js:211:9512)
    at https://unpkg.com/[email protected]/dist/index.min.js:56:27862
    at https://unpkg.com/[email protected]/dist/index.min.js:8:30814
    at iteratorCallback (https://unpkg.com/[email protected]/dist/index.min.js:8:29045)
    at https://unpkg.com/[email protected]/dist/index.min.js:5:28176
    at Object.callback (https://unpkg.com/[email protected]/dist/index.min.js:56:27831)
    at https://unpkg.com/[email protected]/dist/index.min.js:56:29218
    at https://unpkg.com/[email protected]/dist/index.min.js:5:28176

and a 403 error on the command line.

I'll be troubleshooting the js side of things to make sure nothing weird is going on there, but the 403 error seems to be coming from the go node and not a CORS issue.

Frame 1661: 278 bytes on wire (2224 bits), 278 bytes captured (2224 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 7002, Dst Port: 63426, Seq: 1, Ack: 538, Len: 222
Hypertext Transfer Protocol
    HTTP/1.1 403 Forbidden\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 403 Forbidden\r\n]
            [HTTP/1.1 403 Forbidden\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Request Version: HTTP/1.1
        Status Code: 403
        Response Phrase: Forbidden
    Content-Type: text/plain; charset=utf-8\r\n
    Sec-Websocket-Version: 13\r\n
    X-Content-Type-Options: nosniff\r\n
    Date: Tue, 05 Sep 2017 17:12:28 GMT\r\n
    Content-Length: 38\r\n
        [Content length: 38]
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.000128000 seconds]
    [Request in frame: 1659]
    File Data: 38 bytes
Line-based text data: text/plain
    Forbidden\n
    Failed to upgrade websocket\n

This is the actual response - so don't seem like the browser is blocking it due to CORS, its the actual node responding with the error.

Let me know if there is anything else I can do to help resolve this issue.

@diasdavid @dignifiedquire could you help look into this?

@whyrusleeping I'll debug this.

Re-opining this issue won't be fixed until we update the libp2p dep.

@dryajov The fix has been merged to master. Can you confirm that it works?

@Stebalien I was able to confirm the fix in master. 馃憤

Was this page helpful?
0 / 5 - 0 ratings