jsreport / jsreport

javascript based business reporting platform :rocket:
https://jsreport.net
GNU Lesser General Public License v3.0
1.17k stars 225 forks source link

After updating puppeteer from 22.6.0 to version 22.13.1, render method is getting failed with Error: Report timeout. Last profiler operation: (recipe) chrome-pdf. #1152

Closed nisarga0101 closed 3 weeks ago

nisarga0101 commented 1 month ago

after updating puppeteer to version 22.13.1 , render method is getting failed with error "Report render failed (because) report timeout. Last profiler operation: (recipe) chrome-pdf Error: Report timeout. Last profiler operation: (recipe) chrome-pdf"

and I am not seeing this issue for puppeteer versions up to 22.8.2, if I update puppeteer above 22.8.2 getting above error

Packages used : "@jsreport/jsreport-chrome-pdf": "4.1.0", "@jsreport/jsreport-core": "4.4.0", "@jsreport/jsreport-handlebars": "4.0.1",

Expectation report creation should works fine using @jsreport-core using puppeteer version 22.13.1

image

bjrmatos commented 1 month ago

hi @nisarga0101

can you share the template and related entities you are using?

jsreport uses puppeteer 22.11.2, if the render looks different not is likely then that new puppeteer has some issue, or maybe it just takes more time to render, perhaps you can also try increasing the reportTimeout config to a greater value than the default (which is 60000)

nisarga0101 commented 1 month ago

Hi bjrmatos,

Here is the render method, const res = await this.jsreport.render({ template: { content: "", engine: "handlebars", recipe: "chrome-pdf", chrome: { url: this.url, format: chromeTemplateConfig.format, path: chromeTemplateConfig.path, displayHeaderFooter: true, headerTemplate: await this.validateAndGetHeaderTemplate(), footerTemplate: await this.validateAndGetFooterTemplate(), marginTop: chromeTemplateConfig.marginTop, marginBottom: chromeTemplateConfig.marginBottom, marginRight: chromeTemplateConfig.marginRight, marginLeft: chromeTemplateConfig.marginLeft, printBackground: chromeTemplateConfig.printBackground, waitForNetworkIddle: chromeTemplateConfig.waitForNetworkIddle, } }, data: this.chromeTemplateData });

note:  we are passing our own template url here.

 Things I tried out -- > * I increased the reportTimeout above 60000, that didnt helped to solve this issue.
                                  * I also tried to render only less content(simple name in html tag) , there also issue is same.
pofider commented 1 month ago

This will be the following problem https://forum.jsreport.net/topic/3234/read-this-if-you-experience-chrome-pdf-hanging-on-windows-in-jsreport-4-5-0

nisarga0101 commented 1 month ago

Hi pofider,

when can we except the [(https://forum.jsreport.net/topic/3234/read-this-if-you-experience-chrome-pdf-hanging-on-windows-in-jsreport-4-5-0)] fix for this issue. And please update once jsreport is updated accordingly

pofider commented 3 weeks ago

The jsreport 4.6.0 now includes fixed chrome/puppeteer so there should be no need for extra setting permissions on Windows now.

nisarga0101 commented 2 weeks ago

Hi, we are using 'https://www.npmjs.com/package/@jsreport/jsreport-core', I have upgraded the @jsreport/jsreport-core to the latest version, now pdf buffer is getting created but still not able to generate the report successfully image

private async renderReport() { try { this._logger.log(LogLevel.info, "initializing jsreport"); await this.jsreport.init() this._logger.log(LogLevel.info, "start rendering the teamplate"); const templateConfig = config.chromeProperties.chromeTemplate; const chromeTemplateConfig = templateConfig.chrome; const res = await this.jsreport.render({ template: { content: "", engine: "handlebars", recipe: "chrome-pdf", chrome: { url: this.url, format: chromeTemplateConfig.format, path: chromeTemplateConfig.path, displayHeaderFooter: true, headerTemplate: await this.validateAndGetHeaderTemplate(), footerTemplate: await this.validateAndGetFooterTemplate(), marginTop: chromeTemplateConfig.marginTop, marginBottom: chromeTemplateConfig.marginBottom, marginRight: chromeTemplateConfig.marginRight, marginLeft: chromeTemplateConfig.marginLeft, printBackground: chromeTemplateConfig.printBackground, waitForNetworkIddle: chromeTemplateConfig.waitForNetworkIddle, } }, data: this.chromeTemplateData }); await this.jsreport.close(); return res.content; } catch (err) { this._logger.log(LogLevel.error, "unable to generate report :" + err); } }

"dependencies": { "@jsreport/jsreport-chrome-pdf": "4.1.0", "@jsreport/jsreport-core": "4.4.1", "@jsreport/jsreport-handlebars": "4.0.1", "axios": "1.7.4", "bluebird": "3.7.2", "express": "4.19.2", "express-async-errors": "3.1.1", "handlebars": "4.7.8", "inversify": "6.0.1", "inversify-express-utils": "6.4.3", "joi": "17.10.2", "pqadvisor-analyticsdb-wrapper": "1.7.0", "puppeteer": "23.0.2", "reflect-metadata": "0.1.13", "winston": "3.10.0" },

Please suggest the approach to resolve this issue