electron-pdf on Windows / NodeIIS timeouts
-
Yeah it's configured with 2 cores right now. And I'm just rendering a Hello world, so the template shouldn't be intensive in any way.
-
@srijken what is your jsreport config? what version of electron have you installed? and how you installed it, are you using
electron
orelectron-prebuilt
package? also try to run jsreport withDEBUG=electron-*
env var to get more logs of what is going on and share it here
-
@srijken also, can you try to run jsreport outside of IISNode and test if it works? just like a raw node.js app.. previously we had bad experiences trying to make it work https://github.com/bjrmatos/electron-html-to/issues/18 , IISNode is a special environtment because it reimplements some parts of node.js and has some runtime differences that make it difficult to support, so at this point i'm not 100% sure that electron works under IISNode
-
Tried both electron and electron-prebuilt. Currently electron is installed version 1.6.6.
report config:
{ "certificate": { "key": "certificates/jsreport.net.key", "cert": "certificates/jsreport.net.cert" }, "authentication": { "cookieSession": { "secret": "<your strong secret>" }, "admin": { "username": "admin", "password": "password" }, "enabled": true }, "connectionString": { "name": "fs" }, "httpPort": 5488, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "debug", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "blobStorage": "fileSystem", "phantom": { "strategy": "dedicated-process", "timeout": 60000 }, "electron":{ "strategy": "dedicated-process", "timeout": 60000, "numberOfWorkers": 2 }, "tasks": { "strategy": "in-process", "timeout": 10000, "allowedModules": "*" }, "scripts": { "allowedModules": "*", "timeout": 60000 }, "sample-template": { "createSamples": true } }
log:
2017-05-09T14:57:42.391Z - debug: Resources not defined for this template. requestId=1 2017-05-09T14:57:42.391Z - debug: Rendering engine handlebars requestId=1 2017-05-09T14:57:43.141Z - debug: Compiled template not found in the cache, compiling timestamp=Tue May 09 2017 16:57:43 GMT+0200 (W. Europe Daylight Time), requestId=1 2017-05-09T14:57:43.141Z - debug: Replaced images [] requestId=1 2017-05-09T14:57:43.141Z - debug: Executing recipe electron-pdf requestId=1 2017-05-09T14:57:43.141Z - debug: Electron Pdf recipe start. 2017-05-09T14:58:43.320Z - error: Error when processing render request Error during rendering report: Timeout when executing in electron Error: Timeout when executing in electron at Timeout._onTimeout (e:\sites\jsreports\www\node_modules\electron-html-to\lib\dedicatedProcessStrategy.js:272:20) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5) requestId=1
and
2017-05-09T14:57:43.141Z - [34mdebug[39m: Electron Pdf recipe start. Tue, 09 May 2017 14:57:43 GMT electron-html-to:conversion generating new conversion task.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:conversion conversion task id: 9367e631-6f08-4e08-8867-0d324cd78395 Tue, 09 May 2017 14:57:43 GMT electron-html-to:conversion creating temporal html files in C:\Windows\TEMP\jsreport-temp.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:conversion creating temporal html file [type: html] in C:\Windows\TEMP\jsreport-temp\9367e631-6f08-4e08-8867-0d324cd78395html.html.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:conversion starting conversion task [strategy:dedicated-process][task id:9367e631-6f08-4e08-8867-0d324cd78395] with options: { browserWindow: { width: undefined, height: undefined, webPreferences: { javascript: true } }, waitForJSVarName: 'JSREPORT_READY_TO_START', collectLogs: true, delay: undefined, waitForJS: false, converterPath: 'e:\\sites\\jsreports\\www\\node_modules\\electron-html-to\\lib\\converters\\pdf.js', pdf: { marginsType: undefined, pageSize: undefined, printBackground: true, landscape: false }, htmlFile: 'C:\\Windows\\TEMP\\jsreport-temp\\9367e631-6f08-4e08-8867-0d324cd78395html.html', url: 'file:C:\\Windows\\TEMP\\jsreport-temp\\9367e631-6f08-4e08-8867-0d324cd78395html.html', chromeCommandLineSwitches: { 'ignore-certificate-errors': null }, extraHeaders: {}, output: { tmpDir: 'C:\\Windows\\TEMP\\jsreport-temp', id: '9367e631-6f08-4e08-8867-0d324cd78395' } } Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy saving settings in temporal file.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy searching electron executable path.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy trying to get electron path from "electron" module.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy running in IISNODE.. Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy spawning new electron process with args: [ 'e:\\sites\\jsreports\\www\\node_modules\\electron-html-to\\lib\\scripts\\standaloneScript.js' ] and options: { env: { ELECTRON_WORKER_ID: '9367e631-6f08-4e08-8867-0d324cd78395', ELECTRON_HTML_TO_SETTINGS_FILE_PATH: 'C:\\Windows\\TEMP\\jsreport-temp\\9367e631-6f08-4e08-8867-0d324cd78395settings.html', DISPLAY: undefined, IISNODE_VERSION: '0.2.21' }, stdio: [ null, null, null, 'ipc' ] } Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy electron process pid: 4192 Tue, 09 May 2017 14:57:43 GMT electron-html-to:dedicated-process-strategy processing conversion.. Tue, 09 May 2017 14:58:43 GMT electron-html-to:dedicated-process-strategy conversion timeout.. Tue, 09 May 2017 14:58:43 GMT electron-html-to:dedicated-process-strategy electron process exit with code: null and signal: SIGTERM 2017-05-09T14:58:43.304Z - [31merror[39m: Error when processing render request Error during rendering report: Timeout when executing in electron Error: Timeout when executing in electron at Timeout._onTimeout (e:\sites\jsreports\www\node_modules\electron-html-to\lib\dedicatedProcessStrategy.js:272:20) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5) requestId=1 2017-05-09T14:58:43.320Z - [31merror[39m: Error during processing request: http://jsreports/api/report/test details: Error during rendering report: Timeout when executing in electron Error: Timeout when executing in electron at Timeout._onTimeout (e:\sites\jsreports\www\node_modules\electron-html-to\lib\dedicatedProcessStrategy.js:272:20) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)
-
When running without IISNode it works as expected. This setup works for me just as well..
What's the best way to run jsreport as a windows service so that it starts op when the machine boots?
-
@srijken you can use the winser module (that under the hood uses nssm, which you can use directly if you like) to wrap jsreport as a windows service where you can configure that the service should start on machine's boots.
you can also use our
jsreport win-install
cli command to execute this for you
-
Thanks, that works
-
One more question about
jsreport win-install
: How can I configure it to run in production instead of develop?
-
@srijken just set
NODE_ENV = production
before running the command, in windows is something like this:set NODE_ENV production && jsreport win-install
-
thanks again