{"action":"created","issue":{"url":"https://api.github.com/repos/ipfs/js-ipfs/issues/1326","repository_url":"https://api.github.com/repos/ipfs/js-ipfs","labels_url":"https://api.github.com/repos/ipfs/js-ipfs/issues/1326/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/js-ipfs/issues/1326/comments","events_url":"https://api.github.com/repos/ipfs/js-ipfs/issues/1326/events","html_url":"https://github.com/ipfs/js-ipfs/issues/1326","id":317751056,"node_id":"MDU6SXNzdWUzMTc3NTEwNTY=","number":1326,"title":"Websocket connection errors on startup should be clearer and not crash IPFS","user":{"login":"shessenauer","id":4613507,"node_id":"MDQ6VXNlcjQ2MTM1MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/4613507?v=4","gravatar_id":"","url":"https://api.github.com/users/shessenauer","html_url":"https://github.com/shessenauer","followers_url":"https://api.github.com/users/shessenauer/followers","following_url":"https://api.github.com/users/shessenauer/following{/other_user}","gists_url":"https://api.github.com/users/shessenauer/gists{/gist_id}","starred_url":"https://api.github.com/users/shessenauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shessenauer/subscriptions","organizations_url":"https://api.github.com/users/shessenauer/orgs","repos_url":"https://api.github.com/users/shessenauer/repos","events_url":"https://api.github.com/users/shessenauer/events{/privacy}","received_events_url":"https://api.github.com/users/shessenauer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-04-25T18:52:06Z","updated_at":"2018-06-11T18:12:11Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n- **Version**: \"ipfs\": \"^0.28.2\"\r\n- **Platform**: Linux on AWS EC2 (Dockerized API)\r\n- **Subsystem**: /ipfs/src/core/boot.js or p2plib?\r\n\r\n<!-- Bug, Feature, Question, Enhancement, Etc -->\r\n#### Type: Bug\r\n\r\n#### Severity:Critical - System crash, application panic.\r\n\r\n#### Description:\r\nUpon start of the application, it starts normally - then as soon as the IPFS js node gets initialized, the application throws a critical error with the following: \r\n```\r\nApp starting..\r\n\r\nevents.js:165\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: websocket error\r\n    at WS.Transport.onError (/path/to/application/node_modules/engine.io-client/lib/transport.js:64:13)\r\n    at WebSocket.ws.onerror (/path/to/application/node_modules/engine.io-client/lib/transports/websocket.js:150:10)\r\n    at WebSocket.onError (/path/to/application/node_modules/ws/lib/EventTarget.js:109:16)\r\n    at WebSocket.emit (events.js:180:13)\r\n    at WebSocket.finalize (/path/to/application/node_modules/ws/lib/WebSocket.js:182:41)\r\n    at ClientRequest._req.on (/path/to/application/node_modules/ws/lib/WebSocket.js:653:12)\r\n    at ClientRequest.emit (events.js:180:13)\r\n    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:539:21)\r\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)\r\n    at TLSSocket.socketOnData (_http_client.js:444:20)\r\nEmitted 'error' event at:\r\n    at done (/path/to/application/node_modules/ipfs/src/core/boot.js:58:19)\r\n    at /path/to/application/node_modules/async/internal/parallel.js:39:9\r\n    at /path/to/application/node_modules/async/internal/once.js:12:16\r\n    at iterateeCallback (/path/to/application/node_modules/async/internal/eachOfLimit.js:44:17)\r\n    at /path/to/application/node_modules/async/internal/onlyOnce.js:12:16\r\n    at /path/to/application/node_modules/async/internal/parallel.js:36:13\r\n    at done (/path/to/application/node_modules/ipfs/src/core/components/start.js:15:16)\r\n    at series (/path/to/application/node_moduless/ipfs/src/core/components/start.js:39:25)\r\n    at /path/to/application/node_modules/async/internal/parallel.js:39:9\r\n    at /path/to/application/node_modules/async/internal/once.js:12:16\r\n\r\n```\r\n\r\nIn the configuration, I have a node.js application that uses IPFS-js. I have the application dockerized as well as a full ipfs dockerized node that websockets as a peer to the IPFS-js app. This works perfectly fine and I have had no problem until last night when every single one of my environments started throwing the same error out of nowhere. Now none of my team can spin up the api because it has the same issue. One odd thing is that in the gap of time before it crashes, we can spam the API with a curl and get back the IPFS results for a quick second, otherwise it fails. I have confirmed it is not a websocket issue on my end and it is infact something with the IPFS-js package in the nodeJS application. Guidance is much appreciated.\r\n\r\n#### Steps to reproduce the error:\r\n\r\n1. npm install ipfs\r\n2. set the options for websockets \r\n```\r\nlet options = {\r\n  config: {\r\n    Addresses: {\r\n      Swarm: [\r\n        // '/dns4/wrtc-star.discovery.libp2p.io/tcp/443/wss/p2p-webrtc-star'\r\n        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'\r\n      ]\r\n    }\r\n  }\r\n}\r\n```\r\n3. initialize the node \r\n```const ipfsNode = new IPFS(options)```\r\n```\r\n4.  Connect to swarm\r\nipfsNode.on('ready', () => {\r\n  // Your node is now ready to use \\o/\r\n  console.log('IPFS Online Status: ', ipfsNode.isOnline())\r\n  ipfsNode.swarm.connect(ipfsPeer, (err, result) => {\r\n    console.log('connecting to peers: ', result)\r\n    ipfsNode.swarm.peers((err, peerCount) => {\r\n      console.log('There are this many peers: ', peerCount)\r\n    })\r\n  })\r\n  ```\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ipfs/js-ipfs/issues/comments/396335322","html_url":"https://github.com/ipfs/js-ipfs/issues/1326#issuecomment-396335322","issue_url":"https://api.github.com/repos/ipfs/js-ipfs/issues/1326","id":396335322,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjMzNTMyMg==","user":{"login":"Mr0grog","id":74178,"node_id":"MDQ6VXNlcjc0MTc4","avatar_url":"https://avatars0.githubusercontent.com/u/74178?v=4","gravatar_id":"","url":"https://api.github.com/users/Mr0grog","html_url":"https://github.com/Mr0grog","followers_url":"https://api.github.com/users/Mr0grog/followers","following_url":"https://api.github.com/users/Mr0grog/following{/other_user}","gists_url":"https://api.github.com/users/Mr0grog/gists{/gist_id}","starred_url":"https://api.github.com/users/Mr0grog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mr0grog/subscriptions","organizations_url":"https://api.github.com/users/Mr0grog/orgs","repos_url":"https://api.github.com/users/Mr0grog/repos","events_url":"https://api.github.com/users/Mr0grog/events{/privacy}","received_events_url":"https://api.github.com/users/Mr0grog/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T18:12:11Z","updated_at":"2018-06-11T18:12:11Z","author_association":"CONTRIBUTOR","body":"Re-opening (and re-titling) this to track things a little more clearly. There are two things to address here:\r\n\r\n1. This error message needs to be more clear (“failed to connect to websocket ${address}” or something.\r\n\r\n2. A connection failure (probably for any swarm connection?) should not be fatal for IPFS.\r\n\r\nThese is tied in with #1325, but are concrete enough we should be able to address them sooner and more directly."}}
{"actor":{"display_login":"Mr0grog"}}