-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation timeout exceeded error #35
Comments
Hi @coxfrederic, Generally, "TimeoutError: Navigation timeout of 30000 ms exceeded" means the page took more than 30s to load and render, which is very unlikely. If the page loads fast in a browser, it should also load fast in this library. You need to make sure that all external URLs in the HTML are accessible from the machine where you execute the library. For example, if you have a script like <script src="http://localhost/my.js"> it could actually end up in the mentioned error, since the external resource couldn't be loaded. If that doesn't help, you can send the HTML to my email, maybe I can spot something. |
Hi @spiritix , Thanks for your quick response. The memory on the server is limited to 2GB and I found online that Puppeteer needs around 1GB of RAM ? So we increased the memory on the server to see if that improves things. The external URL we will replace with images instead of using fontawesome. I see the library is creating a new instance of a browser each time and closes it. Is that the preferred way or is there also an option to re-use the same instance? Would that improve things or actually not? |
Indeed, puppeteer resp. Chromium in general uses quite a lot of RAM. Increasing memory on the server might make it a bit faster and more stable, but it shouldn't have such a great impact. Currently the library doesn't re-use browser sessions, as it's request based, like PHP is in general. It's not optimized for generating a huge bunch of PDF files in a row. This would be a good improvement for the future. |
Currently our problem seems solved by upgrading RAM, but an option for the library to re-use the same instance for X amount of time would indeed be very nice in some use cases. I'll keep an eye on it and will close this issue for now. Anyway, awesome work on this library, and thanks for your help! |
I'm reopening this issue since I'm getting the same error for a page that loads a lot of content. In my browser it takes around 65-70 seconds. I have tried setting the timeout option to 300 seconds but it doesn't have any effect. I'm still getting the TimeoutError: Navigation timeout of 30000 ms exceeded after 30 seconds. How come the timeout value is not taken into account? Any solution to this problem? |
Can you try to open the website directly in Puppeter and convert it to PDF, to see how long it takes to load? Something like this should do it:
|
It takes around 65 seconds to load |
@coxfrederic Thanks, this confirms that it's an issue with Puppeter. Maybe this fix helps? puppeteer/puppeteer#1846 (comment) If so, I can implement it in this library |
Yes! That would be amazing if you could implement it |
What I don't understand though, the timeout is still at 30seconds. So it is ignored? |
Indeed, those issues are not related. I suspect that the timeout is coming from PHP and not from Puppeter, because in PHP the default timeout is also 30 seconds. |
Based on the error I do not believe it is a PHP timeout. TimeoutError: Navigation timeout of 30000 ms exceeded It is thrown in public function convert(): OutputInterface |
Indeed, the error isn't coming from PHP. Will have to investigate this further once I have some time. Meanwhile, I released a new version of the library containing the fix mentioned earlier. |
We are still getting this issue, haven't found a solution yet, I think the amount of data is too large so we need a way to expand the default timeout of 30s I guess |
We are having the same timeout issue. We are currently stuck on version v1.6.1. |
Hi,
I'm using this wonderful library to print out some labels that are being created in HTML.
We create the HTML and it contains just simple texts and a barcode SVG but nothing too fancy. Some icons are loaded through fontawesome.
and when the HTML is populated we set it like this:
$input = new StringInput(); $input->setHtml($labelsHtml); $converter = new Converter($input, new EmbedOutput()); $converter->setOptions([ 'printBackground' => true, 'landscape' => true, 'width' => $height, 'height' => $width, 'margin' => ['top' => '5mm', 'right' => '5mm', 'bottom' => '5mm', 'left' => '5mm'] ]); $output = $converter->convert(); $output->embed('labels' . DateHelper::now(false, 'd-m-Y-H-i-s') . '.pdf');
We have been using this for quite some time but recently been noticing it takes a lot of time. On the same link we got a timeout earlier today, now it is working, but since fontawesome is loading very fast for me I'm wondering if that is the delay.
Since we set HTML, and there is nothing external except fontawesome, what could be triggering this timeout?
Also, is there something we need or can do to speed up the process? Like for example in PHP kill the process or something?
Trying to figure out what might be causing the delay.
Any help is appreciated, see the error below:
Spiritix\Html2Pdf\ConverterException /var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/src/Spiritix/Html2Pdf/Converter.php in Spiritix\Html2Pdf\Converter::convert Binary error: node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */); ^ TimeoutError: Navigation timeout of 30000 ms exceeded at /var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/LifecycleWatcher.js:100:111 at async DOMWorld.setContent (/var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/DOMWorld.js:152:23) at async Page.setContent (/var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/Page.js:482:9) at async Converter._convert (/var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/lib/Converter.js:76:9) at async Converter.run (/var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/lib/Converter.js:37:24) at async /var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/index.js:23:20 -- ASYNC -- at Frame. (/var/OurPlatform/vendor/spiritix/php-chrome-html2pdf/node_modules/puppeteer/lib/helper.js:94:19) at Page.setContent (/var/OurPlatform/vendor/spiritix/php-chrome-html2p...php
The text was updated successfully, but these errors were encountered: