{"action":"created","issue":{"url":"https://api.github.com/repos/mcollina/autocannon/issues/101","repository_url":"https://api.github.com/repos/mcollina/autocannon","labels_url":"https://api.github.com/repos/mcollina/autocannon/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/mcollina/autocannon/issues/101/comments","events_url":"https://api.github.com/repos/mcollina/autocannon/issues/101/events","html_url":"https://github.com/mcollina/autocannon/issues/101","id":208632164,"number":101,"title":"Debugging connectivity issues | reqError === undefined","user":{"login":"anoff","id":7142618,"avatar_url":"https://avatars.githubusercontent.com/u/7142618?v=3","gravatar_id":"","url":"https://api.github.com/users/anoff","html_url":"https://github.com/anoff","followers_url":"https://api.github.com/users/anoff/followers","following_url":"https://api.github.com/users/anoff/following{/other_user}","gists_url":"https://api.github.com/users/anoff/gists{/gist_id}","starred_url":"https://api.github.com/users/anoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anoff/subscriptions","organizations_url":"https://api.github.com/users/anoff/orgs","repos_url":"https://api.github.com/users/anoff/repos","events_url":"https://api.github.com/users/anoff/events{/privacy}","received_events_url":"https://api.github.com/users/anoff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-02-18T10:47:10Z","updated_at":"2017-02-18T15:27:33Z","closed_at":null,"body":"I'm trying to set up autocannon and think I'm having some connectivity issues. Running against a local instance works fine.\r\nHowever if I target the remote machine I want to test, all requests seem to error. I suspect issues with proxy or broken SSL chains.\r\n\r\nI couldn't figure out how to debug the request errors though. Is there a way to print each requests response/error message? It would help a lot to narrow down the problem.\r\n\r\n```javascript\r\nconst inst = autocannon({\r\n  url: 'http://localhost:5010/api/v1/endpoint',\r\n  connections: 10,\r\n  pipelining: 20,\r\n  duration: 10,\r\n  method: 'POST',\r\n  headers: {\r\n    'Content-Type': 'application/json'\r\n  },\r\n  body: payload\r\n}, (err, res) => {\r\n    console.error(err);\r\n    console.log(res);\r\n});\r\n\r\nlet cnt = 0;\r\ninst.on('reqError', e => console.log(`Request error (${cnt++}): ${e}`));\r\n```\r\n\r\nWhat happens is that I see a lot of those `Request error` logs but apparently there is no argument passed to it, so `e===undefined`"},"comment":{"url":"https://api.github.com/repos/mcollina/autocannon/issues/comments/280852413","html_url":"https://github.com/mcollina/autocannon/issues/101#issuecomment-280852413","issue_url":"https://api.github.com/repos/mcollina/autocannon/issues/101","id":280852413,"user":{"login":"thekemkid","id":6907399,"avatar_url":"https://avatars.githubusercontent.com/u/6907399?v=3","gravatar_id":"","url":"https://api.github.com/users/thekemkid","html_url":"https://github.com/thekemkid","followers_url":"https://api.github.com/users/thekemkid/followers","following_url":"https://api.github.com/users/thekemkid/following{/other_user}","gists_url":"https://api.github.com/users/thekemkid/gists{/gist_id}","starred_url":"https://api.github.com/users/thekemkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thekemkid/subscriptions","organizations_url":"https://api.github.com/users/thekemkid/orgs","repos_url":"https://api.github.com/users/thekemkid/repos","events_url":"https://api.github.com/users/thekemkid/events{/privacy}","received_events_url":"https://api.github.com/users/thekemkid/received_events","type":"User","site_admin":false},"created_at":"2017-02-18T15:27:33Z","updated_at":"2017-02-18T15:27:33Z","body":"Also, for other purposes: \r\n\r\nYou can access the events the internal http client emits, using the setupClient property of the options. Check here: https://github.com/mcollina/autocannon#client-events (The internal error events aren't documented, that might be worth a PR)\r\n\r\nYou can use this to see if the errors are timeouts or connection errors, and if they're connection errors, get access to the error object passed to the socket that created it. Here's the snippet you need:\r\n\r\n```javascript\r\nconst inst = autocannon({\r\n  url: 'http://localhost:5010/api/v1/endpoint',\r\n  connections: 10,\r\n  pipelining: 20,\r\n  duration: 10,\r\n  method: 'POST',\r\n  headers: {\r\n    'Content-Type': 'application/json'\r\n  },\r\n  body: payload\r\n   setupClient: setupClientEventHandlers\r\n}, (err, res) => {\r\n    console.error(err);\r\n    console.log(res);\r\n});\r\n\r\nlet cnt = 0;\r\ninst.on('reqError', e => console.log(`Request error (${cnt++}): ${e}`));\r\n\r\nfunction setupClientEventHandlers (client) {\r\n   client.on('connError', (error) => console.log('connection error', error))\r\n   client.on('timeout', (error) => console.log('timeout'))\r\n}\r\n```"}}
{"actor":{"display_login":"thekemkid"}}