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
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 })