4
Help us understand the problem. What are the problem?

posted at

Ruby3.1でherokuにデプロイしたらクラッシュした

起きたこと

herokuにデプロイしたらクラッシュしました。

2022-01-24T00:27:57.846452+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2022-01-24T00:27:58.231038+00:00 app[web.1]: Exiting
2022-01-24T00:27:58.236805+00:00 app[web.1]: /app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- net/smtp (LoadError)

中略

2022-01-24T00:27:58.385873+00:00 heroku[web.1]: Process exited with status 1
2022-01-24T00:27:58.451349+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-24T00:28:04.445190+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=im-el-training.herokuapp.com request_id=a45c6d75-4912-447b-b582-dc0f1b4b3278 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:04.769552+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=im-el-training.herokuapp.com request_id=2b8f6936-c758-4a6a-bef8-1f14a5b55ddb fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:07.700531+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=im-el-training.herokuapp.com request_id=84b7d035-4083-41ef-9a43-bea2f08fc544 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:07.998560+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=im-el-training.herokuapp.com request_id=6a24ebc8-928a-4133-b522-905e196b2cc2 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:10.771035+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=im-el-training.herokuapp.com request_id=90d1509e-6bed-4a3e-90da-2431ae76c2e3 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:11.069054+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=im-el-training.herokuapp.com request_id=ef174c1a-7577-40ba-9913-56f93e035a0f fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:13.514567+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=im-el-training.herokuapp.com request_id=277f6b29-8a4f-479d-8df6-361d187f5891 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https
2022-01-24T00:28:14.149844+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=im-el-training.herokuapp.com request_id=73ac63a2-066e-49f0-9354-f4f04e542944 fwd="164.70.211.58" dyno= connect= service= status=503 bytes= protocol=https

やったこと

普段触らないファイルのLoadErrorなのでbundlerのバージョンを疑ったりしましたが解決せず。

結論、Ruby3.1で標準ライブラリからいくつかのライブラリが除外されていたことが原因でした。
文字通りのcannot load such fileでした…。

引用元:https://www.ruby-lang.org/ja/news/2021/12/25/ruby-3-1-0-released/

以下のライブラリが新たに bundled gems になりました。Bundler から利用する場合は Gemfile に明示的に指定してください。 net-ftp 0.1.3 net-imap 0.2.2 net-pop 0.1.1 net-smtp 0.3.1 matrix 0.4.2 prime 0.1.2 debug 1.4.0

以下3点を手動で追加したら解決しました。

gem 'net-imap'
gem 'net-pop'
gem 'net-smtp'
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
4
Help us understand the problem. What are the problem?