"Printing failed" error after many requests
-
I'm using a batch process to call the the js reports API using .net to generate thousands of PDFs. It has rate limiting built-in to avoid hitting the concurrent request limits. After a few hundred PDFs are generated, I start seeing the following error in requests and they become more and more frequent until all requests are failing with the same error. The data for these requests is very similar, and running the request manually with the debugger does not hit the error. Any ideas for what might be happening?
I am using the cloud version of jsreports, with handlebars and chrome-pdf.
Protocol error (Page.printToPDF): Printing failed
ProtocolError: Protocol error (Page.printToPDF): Printing failed
at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:62:35)
at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:108:26)
at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:224:26)
at CDPSessionImpl.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:433:78)
at CDPPage.createPDFStream (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:738:88)
at CDPPage.pdf (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:771:37)
at /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:391:27
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/@jsreport/jsreport-chrome-pdf/lib/conversion.js:432:22
-
It appears that Chrome's state gets corrupted somehow.
I wasn't able to replicate the issue when running many thousands of your reports, so I'm not sure what will help here.If you need to run such big batches, perhaps you could use a serverless environment with on-prem jsreport.
Like Azure Container App or AWS Lambda.