Made a small application that once a minute should perform actions on the site and write the result to the database. On the local machine, everything works without errors, but after unloading the application on Jelastic, after launching, everything hangs on the opening line of the pilgrim:

await this.nightmare .goto("https://google.ru") 

Through ssh checked that access to the site from the environment is.

 nodejs@node /home/jelastic $ curl -LI google.com HTTP/1.1 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Referrer-Policy: no-referrer Location: http://www.google.ru/?gfe_rd=cr&dcr=0&ei=0bEwWtmVFYW8zAXtg77wDA Content-Length: 268 Date: Wed, 13 Dec 2017 04:51:29 GMT HTTP/1.1 200 OK Date: Wed, 13 Dec 2017 04:51:29 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=windows-1251 P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info." Server: gws X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN Set-Cookie: 1P_JAR=2017-12-13-04; expires=Fri, 12-Jan-2018 04:51:29 GMT; path=/; domain=.google.ru Set-Cookie: NID=119=P0j48s9F-9vk9vm8EBCmwmhwOI1cPq-u2bn7KAHZlEnzzda4hywYw-NLJqj5 K26i53qyvh3sVmsJ8vdLLjsInQatnCoFrt4k-nV-o-HtsQtxwhOX6Ck_245pUUixxCIX; expires=Th u, 14-Jun-2018 04:51:29 GMT; path=/; domain=.google.ru; HttpOnly Transfer-Encoding: chunked Accept-Ranges: none Vary: Accept-Encoding 

Has anyone ever tried to run this kind of application on jelastic or can it not be done due to some environmental restrictions?

UPDATE

The solution is to install Xvfb

  • one
    nightmare.js is a shell over fantomjs. On older versions of fantomjs, X Server was needed - this is a visual window system. Maybe because of this. - tcpack4
  • phantomjs.org/faq.html A: In PhantomJS 1.4 or earlier, X server is still needed. The workaround is to use Xvfb. Starting with PhantomJS 1.5, it is pure headless and anymore X11 / Xvfb. - tcpack4
  • Try to run pure fantom js with page loading and find the problem by the errors that are generated. - tcpack4
  • @ tcpack4 Really there is no X server on the server. Thanks for the tip. - Bleser

0