Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled 'error' event + exit! #21

Closed
joelabair opened this issue Jun 10, 2013 · 3 comments
Closed

Unhandled 'error' event + exit! #21

joelabair opened this issue Jun 10, 2013 · 3 comments

Comments

@joelabair
Copy link

Firstly - Thanks for contributing this library. I'm having an odd issue though - exclusive to one rather large bit of HTML5 markup.

If I pass this in as an HTML string w/ siteType: 'html' - it dies. If I use a URL to the same content - no issue.

source: http://projects.postclick.net/~jbair/phantom-test.html

Node.js 10.5
└─┬ webshot@0.5.0
  └─┬ phantomjs@1.9.0-6
    ├── adm-zip@0.2.1
    ├── kew@0.1.7
    ├── mkdirp@0.3.5
    ├── ncp@0.4.2
    ├─┬ npmconf@0.0.24
    │ ├─┬ config-chain@1.1.7
    │ │ └── proto-list@1.2.2
    │ ├── inherits@1.0.0
    │ ├── ini@1.1.0
    │ ├─┬ nopt@2.1.1
    │ │ └── abbrev@1.0.4
    │ ├── once@1.1.1
    │ ├── osenv@0.0.3
    │ └── semver@1.1.4
    └─┬ rimraf@2.0.3
      └── graceful-fs@1.1.14

@joelabair
Copy link
Author

bash >node
var fs = require('fs');
var webshot = require('webshot');
var htmlString = fs.readFileSync('../../public_html/phantom-test.html');
webshot(htmlString, './test.png', {siteType:'html'}, function(err) {
if(err) throw err;
console.log('done');
});

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn Unknown system errno 7
at errnoException (child_process.js:975:11)
at Process.ChildProcess._handle.onexit (child_process.js:766:34)

@brenden
Copy link
Owner

brenden commented Jun 17, 2013

Hi, sorry for the late response.

There's an OS size limit on arguments passed to spawned processes, and it looks like htmlString is over the limit. You could still pass the filepath to phantom-test.html:

webshot('file://' + __dirname + '/phantom-test.html', './test.png', function(err) {
  if(err) throw err;
  console.log('done');
});

@joelabair
Copy link
Author

Thanks for following up. That makes sense, if you're not using a unix pipe for the htmlString, and i'm not sure that named pipes are yet supported in node's process.child. It's worth noting the max length for htmlString in the docs. I did revert my code to use an http resource. I tried file:// first - and found http:// was more flexible for my situation.

Again, thanks for following up with the explanation.

@brenden brenden closed this as completed Jun 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants