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.

Horseman exiting when PhantomJS has an error

See original GitHub issue

We’re running a fairly complicated set of tests and the last few days for some reason they’ve been failing. Most of the time it prints the following error:

{ [HeadlessError: Error parsing JSON from phantom: SyntaxError: Unexpected token E
Data from phantom was: Error 403: Directory Listing Denied
Directory listing denied]
  name: 'HeadlessError',
  message: 'Error parsing JSON from phantom: SyntaxError: Unexpected token E\nData from phantom was: Error 403: Directory Listing Denied\nDirectory listing denied' }

… and then exits. But sometimes it just plain exits with no logging (odd).

I’m wondering if there is a specific reason for this behavior, or maybe an undocumented option that can cause horseman to behave differently when something goes wrong in phantom?

Our ideal here is to have our series of tests continue even if one has an issue (and we’d like to log the issue we’re having with as much info as possible). But the major hangup is the script exiting.

(note: I’m aware this could be user error, but I’m not 100% familiar with the script or horseman yet so any help is appreciated).

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:37 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
awlaytoncommented, Jun 2, 2016

I was running it on the machine at my desk which I recently rebuilt @ohenepee , so it’s pretty powerful:

6 core i7 CPU
64 GB ram

So if the issue happen when running out processor power, I guess that won’t happen on that computer. I have some deadline coming up at work, but some point in the future I should be able to test in a VM or something.

0reactions
awlaytoncommented, Jun 24, 2016

That would defeat the purpose of the .reject() @Gazaret. Inside that if is an error condition. A .catch at the end of the chain of horseman actions should catch that reject.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Horseman exiting when PhantomJS has an error -
We're running a fairly complicated set of tests and the last few days for some reason they've been failing. Most of the time...
Read more >
[Solved]-Unhandled rejection Error - horseman-phantom.js
You need to handle promise rejections with: .catch(err => { // handle the error here });. for every promise that is created in...
Read more >
Web Crawling with Node, PhantomJS and Horseman - SitePoint
close(); Failing to close the Horseman instance can result in orphaned PhantomJS processes persisting on the machine.
Read more >
PhantomJS exits after syntax error when running unit tests
I usually use this code to warn about errors and resume the run (phantomjs) phantom.onError = function(msg, trace) { var msgStack = ['PHANTOM...
Read more >
Replace PhantomJS with Headless Chromium for JavaScript ...
PhantomJS is a “headless” internet browser, meaning it has no user interface. ... The Headless Horseman Pursuing Ichabod Crane — John Quidor ...
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