Error: Navigation Timeout Exceeded: 30000ms exceeded
-
Error: Navigation Timeout Exceeded: 30000ms exceeded at Promise.then (C:\Users\jsreport-git\node_modules\puppeteer\lib\NavigatorWatcher.js:71:21) at <anonymous>
How to solve this?
My data is coming from an api call.
I wasnt getting this error before using the pdf-utils.
-
This means the chrome failed to open the html for pdf printing in time.
Please try to provide more information. Is this happening all the time? Just random?
Can you simplify the report and try to eliminate the problem cause?
Would you be able to replicate it in playground?
https://playground.jsreport.net/
-
yes sir, my repo: https://github.com/anthony-elhaddad/jsreport-jsreport-pdf-util
The error is happening when im using
recipe: 'chrome-pdf',
in
jsreport.render({ template: { content: fs.readFileSync(path.join(__dirname, 'policyPrint.hbs')).toString(), engine: 'handlebars', recipe: 'chrome-pdf', helpers: helpers, pdfOperations: [{ type: 'merge', renderForEveryPage: true, templateShortid: 'header' }], }
instead of
recipe: 'phantom-pdf',
And i need to use chrome-pdf to have the ability to use
jsreport.documentStore.collection('templates').insert({ content: "{{myHelper}}", shortid: 'header', engine: 'handlebars', recipe: 'chrome-pdf', helpers: helpers, chrome: { width: '15cm', height: '1cm' }, });
Thanks in advance
-
@jan_blaha @bjrmatos please, i need some guidance on solving this problem. Thanks in advance
-
i checked your repo https://github.com/anthony-elhaddad/jsreport-jsreport-pdf-util, and for me (at least locally) the endpoint
http://pixel-web:8017/api/Policy/GetPolicyForPrint
is not reachable, so i had to replace the api call with a static data from thepolicyData.json
file of your repo, after doing that the example is runnable but i never get the navigation timeout error.some part of the produced pdf file for me was this:
so i guess that your api call is returning data is some different shape or different value that is causing pdf-utils to not work correctly. to keep looking into it we will need the data that your api call is returning
-
Hi @bjrmatos, the data returning from the endpoint is the same in the policyData.json but x1000, maybe thats why its not loading correctly? Or doesnt have enough time to load with the correct page numbers ??
Thanks in advance
-
maybe, there is a chance that you have a lot of records and the default timeout of 30s is not enough, but for the test it will be better if you can include in your repo another json file with the exact amount of records that your api is returning, i see in your repo that you adapt the data shape after your request ends, so let me know if the new json file that you are going to add includes these modifications or if i will need to just replace the response body of request with the content of that file and the rest of code will adapt the data shape.
-
@bjrmatos this will be done by tomorrow, I will update my post here after I have updated my repo.
Can we increase the default timeout of 30s, if that is the problem?
Thanks for the support and quick reply.
-
Can we increase the default timeout of 30s, if that is the problem?
yes, you can pass the following value here
{ timeout: 100000 }
-
Hello @bjrmatos, my data returned from the api has the same format as the one in
policyData.json
, but it is around 6.5mb in size.
Even if i increased the timeout, it still shows the same error (Timeout exceeded).Loading the data is no problem for me, im getting this error after trying to add a custom page number to pdfGroups (Just as it shows in the repo).
I have updated the
policyData.json
with the exact response from api, having an array of 200 elements, and still getting the same error.
Please checkout the updated repo.I reduced the elements of an array to 47, and this is the max number of elements that works, and took 118 seconds to render.
Your help is much appreciated.
Thanks in advance.
-
@bjrmatos @jan_blaha please guys i need your help to figure it out.
Thanks in advance.
-
hi! i tried your repository again and saw the navigation error, unfortunately seems like your data is too big for chrome-pdf, i reduced the data to about 8k lines in data json file and it work when changing the chrome timeout to
80000
, we found some bug in chrome in the past when using a lot of data with table, maybe there is another bug here that chrome can't handle a lot of tables with a lot of records at the same time.