Active StorageのPDFプレビューでUnrepresentableErrorが出る

ファイルアップロード機能に関して、ActiveStorage::UnrepresentableErrorが出ていた。調べてみるとPDFのプレビュー画像生成が失敗している模様。

[547a3405-8d8d-452a-ab91-a7ce23e920f7] ActionView::Template::Error (ActiveStorage::UnrepresentableError):
[547a3405-8d8d-452a-ab91-a7ce23e920f7]      5:         %figure{ class: "image" }
[547a3405-8d8d-452a-ab91-a7ce23e920f7]      6:           = link_to url_for(f.object.image) do
[547a3405-8d8d-452a-ab91-a7ce23e920f7]      7:               = image_tag f.object.image.representation(gravity: :center, resize:"640x640^", crop:"640x640+0+0").processed
[547a3405-8d8d-452a-ab91-a7ce23e920f7]   

ローカルでは動いていたので、恐らくPDFのプレビューを行うライブラリが入っていないと推測。

$ sudo yum install poppler-utils

これで治った。 ちなみに環境は、Amazon Linux2です。