FerrumをHerokuで動かすためにやったこと

github.com

特に設定を行わずに、Herokuでferrumを実行した場合、以下のようなエラーが出力される。

/app/vendor/bundle/ruby/3.0.0/gems/ferrum-0.11/lib/ferrum/browser/command.rb:32:in `initialize': Could not find an executable for the browser. Try to make it available on the PATH or set environment variable for example BROWSER_PATH="/usr/bin/chrome" (Cliver::Dependency::NotFound)

やったこと

Herokuにbuildpacksをセットする

$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git --app [アプリ名]

.buildpacksを準備する

$ touch .buildpacks
  • .buildpacks
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/heroku/heroku-buildpack-chromedriver.git
https://github.com/heroku/heroku-buildpack-google-chrome.git