Skip to content
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

Page.navigate timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed. #233

Open
rekonder opened this issue Mar 27, 2024 · 2 comments

Comments

@rekonder
Copy link

Hello,

We encountered the following error when using Grover to convert HTML to PDF with the to_pdf:

Page.navigate timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.

Grover Configuration:

Grover.configure do |config|
  config.options = {
    cache: false,
    executable_path: './bin/chromium',
    launch_args: ['--no-sandbox'],
    timeout: 300000
  }
end

Any insights or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated.

Grover version: 1.1.5

@abrom
Copy link
Contributor

abrom commented Apr 7, 2024

Can you provide any details of how you're actually calling to to_pdf? Are you passing in a URL, or HTML? Are you passing any other options to the Grover initialiser?

The timeout option you're setting is used for both the request and conversion timeouts.. although note that this ISN'T used for the launch timeout, which is currently just going to be the default of 30s.. but if you're hitting that you've likely got some pretty nasty resource constraint issues!

Have you had a read of the debugging section of the readme?

@rekonder
Copy link
Author

rekonder commented Apr 8, 2024

We are passing HTML to the to_pdf. We initialize and generate pdf with the next call

Grover.new(
        @report_html,
        format: 'A4',
        print_background: true,
        margin: current_margin,
        display_header_footer: true,
        header_template: @header_html,
        footer_template: @footer_html,
        style_tag_options: @style_tag_options,
        script_tag_options: @script_tag_options,
        page_ranges: "#{cover_pages_shift}-999999",
        emulate_media: 'screen',
        display_url: Rails.application.routes.default_url_options[:host]
      ).to_pdf(@file.path)

I've reviewed the debugging section of the readme, but unfortunately, we're encountering this issue only in our production environment and haven't been able to reproduce it locally.

Can be this issue connected to the next issue Protocol error (Page.navigate): Target closed? Because on the same HTML generation, we now get the mentioned error.

Additionally, regarding the default 30-second timeout, is there a way to adjust this setting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants