node-server-screenshot
node-server-screenshot copied to clipboard
Doesn't seem to be working on nginx server
I just tried to deploy a small script which took screenshot of google.com. When tested on local machine, everything is working perfectly. however once deployed the image is not formed and it returns 504 gateway timeout.
(Read show: false suggestion for heroku app -> that did not work too :( )
Any suggestions ?
I will assume that you have deployed your code as a service with an nginx reverse proxy in front of it.
Since the error code you're getting is 504 gateway timeout
(i assume from nginx) it means that your service fails to respond within the configured timeout of nginx upstream proxy call.
This may be caused by many things, here are a couple off the top of my head:
- the service crashes and hangs the HTTP request from nginx
- the upstream connection is slow (unlikely you can't load google.com in 60 seconds)
- your VM/machine performance is inadequate and cannot start/sustain a chromium instance 3.1) if your machine is good enough to run a chromium instance but not more, make sure you only generate one screenshot at a time, since each call will require another chromium instance.
If none of the above fit your case, i'll need more details about your setup
I further checked the server logs and found this error -
upstream prematurely closed connection while reading response header from upstream
which means my node server is closing the connection when the library is encountered.