Studiosity / grover

A Ruby gem to transform HTML into PDFs, PNGs or JPEGs using Google Puppeteer/Chromium
MIT License
908 stars 104 forks source link

Navigation Timeout on generating pdf #255

Open atif opened 4 weeks ago

atif commented 4 weeks ago

I'm getting a navigation timeout randomly (majorly if I refresh the page). I have a rails end point that returns a pdf generated by Grover (to_pdf). It works fine on first page load but if I refresh the page (it kinda gets unresponsive and results in a navigation timeout).

Also, if change some contents of the html.erb and refresh the page, i get navigation timeout.

Any idea about how to fix this?

abrom commented 3 weeks ago

You're going to have to provide a little context around how you're actually using Grover. What have you tried in the way of debugging ??

itsmegrave commented 1 week ago

I think I have a similiar issue here. Using the debugging variables, I found this error:

(irb):1:in `<main>': Failed to launch the browser process! undefined (Grover::JavaScript::Error)
[31:49:0912/143900.690452:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[31:31:0912/143900.710846:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[31:31:0912/143900.710930:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.

But I think this error is caused by turn off the headless mode 🤔 Using Ruby 3.1.6, Puppeteer 22.13.1 and Grover 1.1.9, inside a docker container.

The error in rails console is (irb):2:in

': Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed. (Grover::JavaScript::ProtocolError). Increased theprotocolTimeoutto300_000` still have the problem (Before I was using Ruby 3.1.2, Puppeteer 18.2.1)

abrom commented 1 week ago

No, this does not appear to be a similar issue. The error message is telling you what your problem is.

Missing X server or $DISPLAY

LMGTFY: https://github.com/puppeteer/puppeteer/issues/8148