johntitus / node-horseman

Run PhantomJS from Node
MIT License
1.45k stars 125 forks source link

Failed to load Kibana 5.4.0 url #290

Closed sergibondarenko closed 7 years ago

sergibondarenko commented 7 years ago

OS: Ubuntu 15 "angular": "^1.4.8" "node-horseman": "^3.3.0" "phantomjs": "^2.1.1"

My app can't open a URI like http://localhost:5606/zej/app/kibana#/dashboard/e1f963a0-46d7-11e7-b6ef-7d503e1dffc2?_g=().

But it opens all simple URIs I get from the Internet or local web apps.

The following error is thrown when horseman tries to open it:

server    log   [15:42:00.325] [error][status][Sentinl][report] ERROR: Error: Failed to GET url: http://localhost:5606/ogb/app/kibana#/dashboard/e1f963a0-46d7-11e7-b6ef-7d503e1dffc2?_g=()
Unhandled rejection Error: Failed to load url
    at checkStatus (/home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/node-horseman/lib/index.js:292:16)
    at tryCatcher (/home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/bluebird/js/release/method.js:39:29)
    at Object.loadFinishedSetup [as onLoadFinished] (/home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/node-horseman/lib/index.js:290:43)
    at /home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/node-phantom-simple/node-phantom-simple.js:636:30
    at Array.forEach (native)
    at IncomingMessage.<anonymous> (/home/trex/Development/kibi/kibi-internal_5_4_0/plugins/sentinl/node_modules/node-phantom-simple/node-phantom-simple.js:617:17)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

Does horseman have any restrictions for redirection or URI symbols? I use the horseman this way.

sergibondarenko commented 7 years ago

The problem was on my site. The app uses a self-signed certificate. And since node-horseman v3 (#91) you must explicitly set an option to ignore such certificates. The solution is to set the ignoreSSLErrors option in a horseman constructor:

import Horseman from 'node-horseman';
const hm = new Horseman({'ignoreSSLErrors': true});