Ferrum Doesn’t Work on Heroku?

yegorckv

Yegor Chsherbakov

Posted on October 29, 2024

Ferrum Doesn’t Work on Heroku?

To work with Ferrum, you need a web driver. Locally, this is simple — a new Chrome window just opens up. But on Heroku, you’ll need to add a buildpack:

heroku buildpacks:add -i 1 heroku-community/chrome-for-testing

Don’t forget to set up Chrome in your CI:

steps:
  - name: Setup Chrome
    uses: browser-actions/setup-chrome@latest
    with:
      chrome-version: stable
Enter fullscreen mode Exit fullscreen mode

Here’s where the problems start: maybe it’s just me, but when generating PDFs with Ferrum, I kept running into a process_timeout error. This error showed up after upgrading to the Heroku chrome-for-testing buildpack.

The fix — enable the no-sandbox option:

Ferrum::Browser.new(browser_options: { 'no-sandbox': nil })
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
yegorckv
Yegor Chsherbakov

Posted on October 29, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Ferrum Doesn’t Work on Heroku?
ferrum Ferrum Doesn’t Work on Heroku?

October 29, 2024