DEV Community

Yegor Chsherbakov
Yegor Chsherbakov

Posted on

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

Top comments (2)

Collapse
 
remy727 profile image
Remy Wang • Edited

Thank you!
But I still have the same issue.
Can you please check GitHub discussion - How can I generate PDF on Heroku container?

Collapse
 
vitkoz profile image
Vitaly Kozadayev

Excellent! Thank you!

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More