FWeinb / nodeshot

A simple screenshot web service powered by Express and node-webkit.
134 stars 9 forks source link

Request failed reason: [object Object] when trying to set up an instance #7

Open wuservices opened 9 years ago

wuservices commented 9 years ago

I tried to set up an instance on DigitalOcean roughly following your instructions and starting with a node.js image just now. Should the latest version and instructions work?

There are 2 issues I'm having now:

  1. When I try to render something, I get {"request":"failed","reason":"[object Object]"}
  2. If I go to /kue, it redirects to /active and returns Cannot GET /active

I think the instructions may be a little out of date or may have some issues.

One other question, you mentioned you need hardware acceleration for 3D CSS to work. Would that work in headless with xvfb in a server environment in the cloud like on DigitalOcean?

neopostmodern commented 9 years ago

I wrote a pull request to fix the typo in the README and the electron dependency.

I'd like to add that I do not get anything when trying to render (the page just loads forever). The log says the following:

info: --- Starting Server ---
info: Server running on port 8080
info: 
info: Request "http://s.codepen.io/FWeinb/fullpage/oyACz", cacheId: "9b56168b052f5f926da8f6366de4ccd0.png" {"format":"png","scrollbar":false,"page":false,"delay":0,"width":1024,"height":600}
info: create a new job
info: Request "http://s.codepen.io/FWeinb/fullpage/oyACz", cacheId: "9b56168b052f5f926da8f6366de4ccd0.png" {"format":"png","scrollbar":false,"page":false,"delay":0,"width":1024,"height":600}
info: attach to a pending screenshot job #2
info: Request "http://s.codepen.io/FWeinb/fullpage/oyACz", cacheId: "9b56168b052f5f926da8f6366de4ccd0.png" {"format":"png","scrollbar":false,"page":false,"delay":0,"width":1024,"height":600}
info: attach to a pending screenshot job #2

Digging around in the code it looks like nodeshot-renderer/app.js:28 should handle this - but it seems to never get called.

EDIT The next day I tried it again and, to my surprise, it works, log attached:

info: Cache timeout for 9b56168b052f5f926da8f6366de4ccd0.png
info: Request "http://s.codepen.io/FWeinb/fullpage/oyACz", cacheId: "9b56168b052f5f926da8f6366de4ccd0.png" {"format":"png","scrollbar":false,"page":false,"delay":0,"width":1024,"height":600}
info: create a new job

Seems the cache just had a broken version back from when electron was missing. I had tried the cache bust (&force), but one has to use &force=1... I'll write a PR there too. @wuservices - can you try this and say if it works now? END OF EDIT

...and I reproduce the exact same error with /kue.

wuservices commented 9 years ago

Thanks @neopostmodern. &force=1 didn't work for me. I still get the same thing: http://45.55.26.206:8080/?url=http://s.codepen.io/FWeinb/fullpage/oyACz

$ killall node; ./start.sh server; ./start.sh renderer 1; tail -f logs/*
Starting Server
Start Renderer

==> logs/renderer-1.log <==
info: --- Starting Renderer ---

==> logs/server.log <==
info: Cache folder "/home/nodeshot/nodeshot/cache"
info: Reload cache from filesystem
info: --- Starting Server ---
info: Server running on port 8080
info: Request "http://s.codepen.io/FWeinb/fullpage/oyACz", cacheId: "9b56168b052f5f926da8f6366de4ccd0.png" {"format":"png","scrollbar":false,"page":false,"delay":0,"width":1024,"height":600}
info: create a new job

==> logs/renderer-1.log <==
info: Process job "http://s.codepen.io/FWeinb/fullpage/oyACz"

==> logs/server.log <==
info: [object Object]

It looks like it's trying to take the screenshot but then it logs an error here: https://github.com/FWeinb/nodeshot/blob/electron-screenshot/nodeshot-renderer/script/app.js#L43-L45. Not sure how to get more info on that error.

Is it an issue that I couldn't install some of the packages? I saw that the README said those fixed something but I couldn't install x-ttcidfont-conf or ttf-mscorefonts-installer. Is there a special repo I need to add or something to get those to install?

Maybe the root issue is with electron. When I ran the example at https://github.com/FWeinb/electron-screenshot-service in the node console, I got this:

Unhandled rejection Error: [object Object]
    at Object.ensureErrorObject (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/util.js:232:20)
    at Promise._rejectCallback (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/promise.js:416:22)
    at /home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/promise.js:433:17
    at tryCatcher (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/util.js:24:31)
    at Promise._settlePromiseFromHandler (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/promise.js:454:31)
    at Promise._settlePromiseAt (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/promise.js:530:18)
    at Promise._settlePromises (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/promise.js:646:14)
    at bound (domain.js:254:14)
    at Promise.runBound (domain.js:267:12)
    at Async._drainQueue (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/async.js:187:12)
    at Async._drainQueues (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/async.js:192:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/nodeshot/nodeshot/node_modules/electron-screenshot-service/node_modules/bluebird/js/main/async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:358:17)