heroku / heroku-buildpack-google-chrome

Run (headless) Google Chrome on Heroku
296 stars 365 forks source link

Add disable-dev-shm-usage to Chrome Options #98

Open jacektrocinski opened 4 years ago

jacektrocinski commented 4 years ago

Heroku’s /dev/shm is often too small to run Google Chrome and as a result generates the following error: session deleted because of page crash from tab crashed

This issue can be resolved by add the option disable-dev-shm-usage and in my opinion should be a default option when running the Google Chrome build pack on Heroku.

At the very least I think this option should be discussed in the README.md since many users report having this issue on Stackoverflow.

CrazybutSolid commented 3 years ago

As a newbie, is this the right way to do so?

chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil)

chrome_opts = { "chromeOptions" => { "binary" => chrome_bin,
                                     args: %w[disable-dev-shm-usage]
                                     } }
Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(chrome_opts),
  )
end

Capybara.javascript_driver = :chrome

I'm still getting errors and

2021-02-07T12:43:42.670067+00:00 app[worker.1]: 4 TID-1uto WARN: Selenium::WebDriver::Error::UnknownError: unknown error: session deleted because of page crash

Even after adding it like that

brodyhoskins commented 3 years ago

I'm getting these errors all the time now. It seems to have happened once I jumped from Chrome 93.0.4577.82 to 94.0.4606.61. I would like to test it out at the old version but I'm reviewing the code here and can't find a way to downgrade Chrome for testing.