question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Unhandled reject Error: Failed to load url` when using SlimerJS

See original GitHub issue

When using Horseman with SlimerJS the following error is returned:

>   horseman phantom created +637ms
  horseman phantom version 1.9.8 +147ms
  horseman page created +154ms
  horseman phantomjs onLoadFinished triggered +117ms [ 'success', 'about:blank', false ] NaN
  horseman .close(). +6ms
Unhandled rejection Error: Failed to load url
    at checkStatus (/Users/user/Projects/project/node_modules/node-horseman/lib/index.js:276:16)
    at tryCatcher (/Users/user/Projects/project/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/user/Projects/project/node_modules/bluebird/js/release/method.js:39:29)
    at Object.loadFinishedSetup [as onLoadFinished] (/Users/user/Projects/project/node_modules/node-horseman/lib/index.js:274:43)
    at /Users/user/Projects/project/node_modules/node-phantom-simple/node-phantom-simple.js:636:30
    at Array.forEach (native)
    at IncomingMessage.<anonymous> (/Users/user/Projects/project/node_modules/node-phantom-simple/node-phantom-simple.js:617:17)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at nextTickCallbackWith2Args (node.js:478:9)
    at process._tickDomainCallback (node.js:433:17)

The following test case will reproduce it:

const Horseman = require('node-horseman');

const config = {
  browser: {
    clientScripts: [],
    timeout: 5000,
    interval: 50,
    loadImages: true,
    switchToNewTab: false,
    // no support from SlimerJS cookiesFile: null,
    // no support from SlimerJS ignoreSSLErrors: false,
    sslProtocol: 'any',
    // no support from SlimerJS webSecurity: true,
    injectJquery: true,
    injectBluebird: false,
    bluebirdDebug: false,
    // no support from SlimerJS proxy: null,
    // no support from SlimerJS proxyType: null,
    // no support from SlimerJS proxyAuth: null,
    phantomPath: '/usr/local/Cellar/slimerjs/0.10.0/bin/slimerjs',
    debugPort: null,
    debugAutorun: true,
  },
  userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.4.10 (KHTML, like Gecko) Version/8.0.4 Safari/600.4.10',
}

const horseman = new Horseman(config.browser);

horseman
  .userAgent(config.userAgent)
  .open('http://google.co.uk/')
  .screenshot('google.jpg')
  .close();

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
winghouchancommented, May 27, 2016

Hey @minhchu this definitely deseveres a new thread. I was able to reproduce the case you posted above.

Also please consider posting all the output, not just the lines describing the error because the lead-up to the error is also very important.

1reaction
awlaytoncommented, Oct 27, 2016

Closing since this is a node-phantom-simple issue and not a horseman one.

See baudehlo/node-phantom-simple#147 for my proposed fix, if you care.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`Unhandled reject Error: Failed to load url` when using SlimerJS
When using Horseman with SlimerJS the following error is returned: > horseman phantom created +637ms horseman phantom version 1.9.8 +147ms horseman page ...
Read more >
Unhandled reject Error: Failed to load url #188 - GitHub
minhchu has reported a bug they are facing where an Unhandled rejection Error: Failed to load url is thrown. This is similar to...
Read more >
Why is this an Unhandled Promise Rejection? - Stack Overflow
What I can't work out is how can I use urlSet.add(scrapeLink); in lastStep() when it doesn't know what scrapeLink is? Any idea ...
Read more >
What does "failed due to an unhandled promise rejection ...
I have a synthetic script which mostly works, but fails consistently near the end with this error: Step 40: Click By.id("te_classbuilder") ...
Read more >
[Solved]-PhantomJS create page from string-phantom.js
Looking at the phantomjs API, page.open requires a URL as the first argument, ... The Javascript that you include into the blank page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found