These are chat archives for rosshinkley/nightmare

30th
Dec 2016
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:28
Hi, I tried to clone the project and make it on an amazon ec2 instance but all the test cases fail for some reason. I am using node version 4.2.6 and npm version 3.5.2. Am I missing something? I am unable to debug as there is no log. Thanks for your help!
Ross Hinkley
@rosshinkley
Dec 30 2016 20:30
@sleepyCoder666 you might want to take a look at segmentio/nightmare#224
willing to bet there's no framebuffer
re logging, you can start your script with DEBUG=nightmare*,electron*
that might provide some useful guidance :)
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:34
Sorry, but in my case I could not make/build nightmare
Ross Hinkley
@rosshinkley
Dec 30 2016 20:34
the makefile runs the unit tests
which starts nightmare
is that what you're referring to?
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:35
yes in my case the makefile fails to run the test cases
yes
Ross Hinkley
@rosshinkley
Dec 30 2016 20:35
yeah
nightmare requires a framebuffer to run properly
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:35
and i have xvfb installed
Ross Hinkley
@rosshinkley
Dec 30 2016 20:35
hm. is it running?
(silly question)
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:35
yes
Ross Hinkley
@rosshinkley
Dec 30 2016 20:37
that still stinks of a framebuffer issue... can you run DEBUG=nightmare*,electron* npm test?
see if that yields anything useful?
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:39
error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory +20ms
nightmare electron child process exited with code 127: command not found - you may not have electron installed correctly +2ms
Ross Hinkley
@rosshinkley
Dec 30 2016 20:39
hang on
ahhhhh right
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:40
so I need to install electron before building nightamre
is that so
Ross Hinkley
@rosshinkley
Dec 30 2016 20:40
no.
nightmare will install electron (formerly electron-prebuilt) for you
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:40
ok
Ross Hinkley
@rosshinkley
Dec 30 2016 20:41
what OS is your EC2 instance running?
you'll want to install libxss
and i think on ubuntu ... it's under... libxss1?
i feel like i've seen that before
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:42
O am using Ubuntu latest version
ok
fwiw
sleepyCoder666
@sleepyCoder666
Dec 30 2016 20:55
thanks. This is the error I am getting now:
Fri, 30 Dec 2016 20:50:32 +0000: ./test/waitForX: FATAL: ./test/waitForX: Gave up waiting for X server :99
Makefile:10: recipe for target 'test' failed
make: * [test] Error 11
May be it has something to do with the x server and not nightmare. So I need to sort it out myself. Thanks for your help. :)
Ross Hinkley
@rosshinkley
Dec 30 2016 21:08
anytime
that looks like electron can't find your virtual display... check what display xvfb is exposing
sleepyCoder666
@sleepyCoder666
Dec 30 2016 21:12
I had run these commands: Xvfb -ac -screen scrn 1280x2000x24 :9.0 &
export DISPLAY=:9.0
Ross Hinkley
@rosshinkley
Dec 30 2016 21:13
hm
offhand that ought to work
sleepyCoder666
@sleepyCoder666
Dec 30 2016 21:14
hmm..
Srepfler Srdan
@schrepfler
Dec 30 2016 22:14
I’m thinking about making a simple api which gets some parameters and uses nightmare underneath to render a screenshot of a url
some questions come to mind, is there a way to have the Nightmare app bootstrapped on the node app startup and then re-use it between requests?
can multiple requests be handled in parallel then? (ex. is there a concept perhaps of tab or web worker which can perform the rendering in the background)
and what are your thoughts about headless-chromium, headless_shell?
Ross Hinkley
@rosshinkley
Dec 30 2016 22:23
@schrepfler technically yes to the reuse question, but then you're making a bottleneck
if your load is going to be mediumish you'd be better off making a new instance
currently, no, there is no "tab" concept, although we've talked about using multiple BrowserWindows (see #593)
Srepfler Srdan
@schrepfler
Dec 30 2016 22:24
yup, I found that issue
I think I’ll go with the new instance approach
Ross Hinkley
@rosshinkley
Dec 30 2016 22:25
the issue there becomes memory
with a single electron instance + multiple browerwindows, it's still pretty expensive
but not nearly as expensive as multiple electron instances
i would like to see electron ported to use headless chromium, but i doubt it will happen anytime soon
i suppose nightmare could be ported to use it directly, but that's a whole other can of worms
it would certainly solve a few problems
but i suspect it would create a lot more :P
Srepfler Srdan
@schrepfler
Dec 30 2016 22:29
Wasn't nightmare using phantom in the old days?
Ross Hinkley
@rosshinkley
Dec 30 2016 22:29
mhm
Srepfler Srdan
@schrepfler
Dec 30 2016 22:29
I remember I think I used it back then
Ross Hinkley
@rosshinkley
Dec 30 2016 22:30
electron was (maybe still is?) easier to set up, and marginally faster
Srepfler Srdan
@schrepfler
Dec 30 2016 22:30
It's way better now
Ross Hinkley
@rosshinkley
Dec 30 2016 22:30
so the switch was made
(well before my time)
Srepfler Srdan
@schrepfler
Dec 30 2016 22:30
Let's see
Sometimes change is good 😀
Ross Hinkley
@rosshinkley
Dec 30 2016 22:31
ha, true :)
Srepfler Srdan
@schrepfler
Dec 30 2016 22:31
That would probably give you tabs as well
Ross Hinkley
@rosshinkley
Dec 30 2016 22:32
what's that, phantom?
Srepfler Srdan
@schrepfler
Dec 30 2016 22:32
And all metrics from dev tools if you want
Headless chromium
Ross Hinkley
@rosshinkley
Dec 30 2016 22:32
ahh
yeah, very true
but it would have to be packaged very carefully
Srepfler Srdan
@schrepfler
Dec 30 2016 22:33
If you could keep your api plus expose theirs it would be perfect mix
Have you thought about using await/async rather than promise based api?
Ross Hinkley
@rosshinkley
Dec 30 2016 22:34
yeah, it's been left alone mostly for support reasons
Srepfler Srdan
@schrepfler
Dec 30 2016 22:35
Makes sense
Ross Hinkley
@rosshinkley
Dec 30 2016 22:35
and you can async/await promises
so
/shrug
Srepfler Srdan
@schrepfler
Dec 30 2016 22:37
How?
Ross Hinkley
@rosshinkley
Dec 30 2016 22:37
want to hit the widest range of people with the least amount of friction
Srepfler Srdan
@schrepfler
Dec 30 2016 22:37
I don't code in JS day to day
Ross Hinkley
@rosshinkley
Dec 30 2016 22:38
ha, me neither (anymore)
i don't remember off the top of my head, i thought you could await node native promises directly
with nightmare it's a bit of a trick, though, i think you'd have to do like
Srepfler Srdan
@schrepfler
Dec 30 2016 22:39
What is your main language?
Ross Hinkley
@rosshinkley
Dec 30 2016 22:39
await nightmare.action().action().then()
right now i'm doing mostly c#
i'd have to tinker with async/await
it's been a bit :P
but yeah, most of my day to day is .net/azure/posh for the moment
Srepfler Srdan
@schrepfler
Dec 30 2016 22:52
I haven’t touched c# since uni
went on to work with java and now scala
with js as a hobby thing