Nodejs, phantomjs, heroku
I used following buildpack to build a phantomjs / nodejs application on
herouku, with no success:
http://github.com/heroku/heroku-buildpack-nodejs.git
and http://github.com/heroku/heroku-buildpack-nodejs
http://github.com/stomita/heroku-buildpack-phantomjs
phantom stderr: execvp(): Permission denied
/app/web.js:127
return ph.createPage(function(err, page) {
^
TypeError: Cannot call method 'createPage' of undefined
at phantom.create.phantomPath (/app/web.js:127:18)
my webjs is:
app.get('/', function(req, res){
// If there is _escaped_fragment_ option, it means we have to
// generate the static HTML that should normally return the Javascript
if(typeof(req.query._escaped_fragment_) !== "undefined") {
phantom.create(function(err, ph) {
return ph.createPage(function(err, page) {
// We open phantomJS at the proper page.
return page.open("http://myurl.com/#!" +
req.query._escaped_fragment_, function(status) {
return page.evaluate((function() {
// We grab the content inside <html> tag...
return document.getElementsByTagName('html')[0].outerHTML;
}), function(err, result) {
// ... and we send it to the client.
res.send(result);
return ph.exit();
});
});
});
},{phantomPath:"/app/vendor/phantomjs/bin"});
}
else
// If there is no _escaped_fragment_, we return the normal index
template.
//res.render('index');
res.sendfile(__dirname + '/app/index.html');
});
if I run it locally on a macbook it works, I use node-phantom-simple
without socket.io and cluster support. I can't change the permissions on
the phantomjs binary, they stay always 700, and heroku support told me,
that i'm responsible for the permissions on the files via buildpack.
Any suggestions?
Thanks, Patrick
No comments:
Post a Comment