Error in rendering reports
-
Thank you, I have fixed that issue. I'm getting new error issue after that
Filter Params {"id":"UPLOADED-24072018117239"}
{ Error: Error during rendering report: connect ECONNREFUSED 127.0.0.1:35847
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/lib/client.js:64:23
at ConcatStream.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/concat-stream/index.js:36:43)
at emitNone (events.js:111:20)
at ConcatStream.emit (events.js:208:7)
at finishMaybe (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:475:14)
at endWritable (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:485:3)
at ConcatStream.Writable.end (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:455:41)
at IncomingMessage.onend (_stream_readable.js:595:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
remoteStack: 'Error: connect ECONNREFUSED 127.0.0.1:35847\n at Object._errnoException (util.js:992:11)\n at _exceptionWithHostPort (util.js:1014:20)\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)' }Please help...
-
hmm this looks something completely differently so please try to describe more what you are doing, i see that your error contains calls to jsreport node.js client so i guess you are trying to render something with http api and get back the response on your server code, is this
127.0.0.1:35847
the real url + port that jsreport is running for you?
-
Hi, Thank you for quick response.
We are running js report on port "httpsPort": 5488,
This is the code used to generate PDF using JS Report:
"JSREPORT_LIB_PATH":"https://[IP]:5488",
"JSREPORT_LIB_USERNAME":"",
"JSREPORT_LIB_PASSWORD":"",var url = JSREPORT_LIB_PATH;
var username = JSREPORT_LIB_USERNAME;
var password = JSREPORT_LIB_PASSWORD;var reportName = "My_Report";
var filePath = GC_RRF_PATH + 'My_Report' + uuid.v4() + '.pdf';
var client = require("jsreport-client")(url, username, password);client.render({
template: {
name: reportName,
engine: 'jsrender',
recipe: 'phantom-pdf'
},
data: results.waiverValues // data from the database
}, function (err, response) {
if (err) {
return console.error(err);
} else {
response.body(function (body) {
fs.writeFile(filePath, body, function (err) {
if (err) {
console.log(err);
return callback(err);
} else {
callback(null, {
path: filePath
});
}
});
});
}
});
-
what version of jsreport are you using? what version of jsreport-client are you using? in latest one (jsreport-client 1.0.0) version calling
client.render
will return a promise (it is not expected a callback anymore), you can find example usage with latest version here.however i don't know why you get an error like this
Error during rendering report: connect ECONNREFUSED 127.0.0.1:35847
, are there any logs/console in the jsreport server? i want to be sure if your request is actually getting into the jsreport server or maybe blocked by something else in the network. maybe the error appears just on first render while trying to render a report, please try to share the logs that are generated by jsreport it will help to know what is happening.
-
I have uninstalled jsreport using 'npm uninstall jsreport-cli -g' and installed it again 'npm install jsreport-cli -g > jsreport init > jsreport configure > jsreport start'
If I run the report in server, it is showing this error...
Error when processing render request Error during rendering report: phantom manager could not start all workers.. Error: phantom manager could not start all workers..
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomManager.js:66:47
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomWorker.js:115:24
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomWorker.js:140:20
at Socket.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/checkPortStatus.js:45:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at TCP._handle.close [as _onclose] (net.js:557:12) requestId=1
2018-07-31T11:00:54.737Z - error: Error during processing request: https://70.33.176.240:5488/api/report details: Error during rendering report: phantom manager could not start all workers.. Error: phantom manager could not start all workers..
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomManager.js:66:47
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomWorker.js:115:24
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/phantomWorker.js:140:20
at Socket.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/phantom-html-to-pdf/node_modules/phantom-workers/lib/checkPortStatus.js:45:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at TCP._handle.close [as _onclose] (net.js:557:12)To generate pdf in local I'm using this configuration...
package.json
"jsreport": "1.7.0",
"jsreport-browser-client-dist": "^1.0.4",
"jsreport-client": "^0.4.1",
"jsreport-jsrender": "^1.0.2",
"jsreport-phantom-pdf": "^1.4.5",
-
Could you please try to set "no" to the configure question: "Should jsrepoirt reuse processes to speed up..."?
In very rare environments we are not able to create internal web servers to speed up things.
The mentioned change could help with this.
-
I uninstalled jsreport and tried to install again...
npm install jsreport-cli -g
/usr/local/bin/jsreport -> /usr/local/lib/node_modules/jsreport-cli/cli.js- jsreport-cli@2.0.3
but it shows this message
'jsreport installation not found, installing jsreport latest version now, wait a moment...'ERROR: Failed to download Chromium r564778! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir '/home/jsreportapp/node_modules/puppeteer/.local-chromium'
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/home/jsreportapp/node_modules/puppeteer/.local-chromium' }
npm WARN pdfjs-dist@2.0.457 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN schema-utils@0.4.5 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jsreport-server@ No description
npm WARN jsreport-server@ No repository field.
npm WARN jsreport-server@ No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@1.5.0 install:node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@1.5.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-07-31T11_55_33_877Z-debug.log
(1).
caused by error (1) -> meta = {"killed":false,"code":1,"signal":null,"cmd":"npm i -S jsreport"}, stack = Error:
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
root@sec-construction-2018:/home/jsreportapp#
-
Try to remove whole content of jsreportapp folder before installing. Backup templates if you have something stored there.
-
We have removed all files and tried installing it again... But still problem persist...
jsreport installation not found, installing jsreport latest version now, wait a moment...
Unexpected error happened: Command failed: npm i -S jsreport
ERROR: Failed to download Chromium r564778! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir '/home/jsreportapp/node_modules/puppeteer/.local-chromium'
-
ERROR: Failed to download Chromium r564778! Set
This can be temporary error on the chromium hosting or your connectivity issue.I see the error mentioned also here https://github.com/GoogleChrome/puppeteer/issues/2173
They recommend something like running this. Which would replacejsreport init
.npm i jsreport --unsafe-perm=true --allow-root
However never tried it, never experienced the mentioned error.
-
Thanks for quick responses...now it is showing like this
root@sec-construction-2018:/home/jsreportapp# npm i jsreport --unsafe-perm=true --allow-root
puppeteer@1.5.0 install /home/jsreportapp/node_modules/puppeteer
node install.jsDownloading Chromium r564778 - 100.9 Mb [====================] 100% 0.0s
root@sec-construction-2018:/home/jsreportapp# jsreport init
No command 'jsreport' found, did you mean:
Command 'sreport' from package 'slurm-llnl' (universe)
Command 'tsreport' from package 'tstools' (universe)
Command 'esreport' from package 'tstools' (universe)
Command 'psreport' from package 'tstools' (universe)
jsreport: command not found
root@sec-construction-2018:/home/jsreportapp# ls
node_modules package-lock.jsonroot@sec-construction-2018:/home/jsreportapp# jsreport configure
No command 'jsreport' found, did you mean:
Command 'tsreport' from package 'tstools' (universe)
Command 'sreport' from package 'slurm-llnl' (universe)
Command 'esreport' from package 'tstools' (universe)
Command 'psreport' from package 'tstools' (universe)
jsreport: command not found
-
You should not call jsreprort init when you installed jsreport already from npm.
However you seems to be missing jsreport-cli installed globally. So install that and then run
jsreport configure
npm i jsreport --unsafe-perm=true --allow-root npm i -g jsreport-cli jsreport configure jsreport start
-
hi @balajisr, just to add more comments about your problems and why you get such weird errors... i think you have the typical npm permissions problem, according to your logs you have this permission error original
{ Error: EACCES: permission denied, mkdir '/home/jsreportapp/node_modules/puppeteer/.local-chromium'
and now you are not able to foundjsreport
command after installing it withnpm i -g jsreport-cli
, this usually means that npm is in dirty state in which it requires that every run of npm should be usingsudo
.the solution for this is to follow npm recommendations described here to fix the permissions problems, i usually install node with nvm and never have to worry about this, you can try uninstall node/npm and install it with
nvm
or follow this guide about changing default npm global installation directory.after fixing npm permissions, i will say that you should try to uninstall the cli
npm uninstall -g jsreport-cli
and then reinstall it againnpm install -g jsreport-cli
and follow thejsreport init > jsreport configure > jsreport start
steps in new fresh directory, if your npm permissions are solved you should not see any permissions error while installingunfortunately we can't control how the user installs node and npm, so there are situations like your case where you get such weird errors when installing jsreport.
-
Thanks for all the help.
We uninstalled node.js and reinstalled using nvm. After this JSReport is showing these errors...
Error: Failed to launch chrome!
[0801/002944.284507:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/home/jsreportapp/node_modules/puppeteer/lib/Launcher.js:285:14) at Interface.helper.addEventListener (/home/jsreportapp/node_modules/puppeteer/lib/Launcher.js:274:50) at emitNone (events.js:111:20) at Interface.emit (events.js:208:7) at Interface.close (readline.js:368:8) at Socket.onend (readline.js:147:10) at emitNone (events.js:111:20) at Socket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)
-
hmm ok, this error is throw when trying to render a report, right? it says that it is still trying to launch chrome as root but let's try the easy solution that is to pass the "--no-sandbox" flag, in your
jsreport.config.json
file add this:(note: i'm showing just the relevant part of the config, you just need to ensure to add these new properties there, the rest of the properties that you already have should stay there)
{ "extensions": { "chrome-pdf": { "launchOptions": { "args": ["--no-sandbox"] } } } }
after that, try to start jsreport and run a report again
-
ok finally, jsreport is working...
but when I try generating report in application, it is showing the following error...
Filter Params {"id":"UPLOADED-24072018117239"}
{ Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/lib/client.js:64:23
at ConcatStream.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/concat-stream/index.js:36:43)
at emitNone (events.js:111:20)
at ConcatStream.emit (events.js:208:7)
at finishMaybe (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:475:14)
at endWritable (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:485:3)
at ConcatStream.Writable.end (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:455:41)
at IncomingMessage.onend (_stream_readable.js:595:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
remoteStack: 'Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.\n at module.exports (/home/jsreportapp/node_modules/jsreport-core/lib/util/createError.js:9:13)\n at Reporter.createError (/home/jsreportapp/node_modules/jsreport-core/lib/reporter.js:258:12)\n at invokeRender (/home/jsreportapp/node_modules/jsreport-core/lib/render/render.js:88:20)\n at <anonymous>' }
-
in jsreport v2, phantom-pdf is not available by default, you can read some notes about the changes in jsreport v2 here.
you can still use use
phantom-pdf
in v2 but you need to install it in your project, usenpm install jsreport-phantom-pdf --save
(latest version of jsreport-phantom-pdf is 2.1.3).note: jsreport v2 has other changes so be sure to read and update carefully your templates if you are trying to use some templates that were working in v1.
-
Hi, we ran npm install jsreport-phantom-pdf --save in server. Phantom PDF is present in the node_modules directory.
Still, we are getting the same error while generating the report
'Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.'
Please advice...
-
Have you restarted jsreport after installing phantom recipe? Please share the output logs.
-
Hi,
Yes, we restarted pm2 after installing jsreport-phantom-pdf.
This is the error we got while generating the PDF.
{ Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.
at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/lib/client.js:64:23
at ConcatStream.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/concat-stream/index.js:36:43)
at emitNone (events.js:111:20)
at ConcatStream.emit (events.js:208:7)
at finishMaybe (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:475:14)
at endWritable (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:485:3)
at ConcatStream.Writable.end (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:455:41)
at IncomingMessage.onend (_stream_readable.js:595:10)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
remoteStack: 'Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.\n at module.exports (/home/jsreportapp/node_modules/jsreport-core/lib/util/createError.js:9:13)\n at Reporter.createError (/home/jsreportapp/node_modules/jsreport-core/lib/reporter.js:258:12)\n at invokeRender (/home/jsreportapp/node_modules/jsreport-core/lib/render/render.js:88:20)\n at <anonymous>' }Thank you for your support.