astefanutti / decktape

PDF exporter for HTML presentations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load timeout option

lnalborczyk opened this issue · comments

Hi,

thank you very much for creating and maintaining this package!

I am using it regularly to export my HTML5 slides (created using RStudio) into .pdf documents. This usually works fine, for instance I can export these slides (https://www.barelysignificant.com/IMSB2020/slides/Cours04) using the following command:

decktape generic https://www.barelysignificant.com/IMSB2020/slides/Cours04 Cours04.pdf

without problem.

However, when I try to export the following course (available online at https://www.barelysignificant.com/IMSB2020/slides/Cours05), the following command:

decktape generic https://www.barelysignificant.com/IMSB2020/slides/Cours05 Cours05.pdf

results in this error:

Loading page https://www.barelysignificant.com/IMSB2020/slides/Cours05 ...
TimeoutError: Navigation Timeout Exceeded: 20000ms exceeded
    at Promise.then (/usr/local/lib/node_modules/decktape/node_modules/puppeteer/lib/LifecycleWatcher.js:143:21)
  -- ASYNC --
    at Frame.<anonymous> (/usr/local/lib/node_modules/decktape/node_modules/puppeteer/lib/helper.js:108:27)
    at Page.waitForNavigation (/usr/local/lib/node_modules/decktape/node_modules/puppeteer/lib/Page.js:682:49)
    at Page.<anonymous> (/usr/local/lib/node_modules/decktape/node_modules/puppeteer/lib/helper.js:109:23)
    at /usr/local/lib/node_modules/decktape/decktape.js:219:21
    at process._tickCallback (internal/process/next_tick.js:68:7)

My guess is that this issue appears because this particular course contains interactive plots, created using the plotly package in R (https://plotly.com/r/), on slides 3 and 12...

Would you have any idea on how to solve this issue?

Best wishes,

Ladislas

Thanks a lot for the kind feedback.

I've just tried exporting the presentation by increasing the following timeout and it works:

const load = page.waitForNavigation({ waitUntil: 'load', timeout: 20000 });

For some reasons, the presentation seems to take quite a lot of time to load. It defaults to 20s as it's long enough for presentations to load, and short enough to timeout and report when there is an issue.

A solution would be to add an option so that you can provide a longer timeout. Also, it may be worth analyse why this particular presentation takes more than 20s to load.

Thank you for your quick answer, it solved it!

My guess is that this specific presentation takes a long time to load because it contains several high resolution .svg figures, some interactive plots, and embedded external web pages (e.g., on slide 34).

Great! Yes it seems the presentation contain some large assets. It may be possible to have them lazy loaded. Anyway, I think it would be useful to have an option to override the default timeout.