We've moved discussions to Discord

Do we need to add libvips buildpack when deploying to Heroku?

Aska Konomi
The app frequently crashes on our Heroku production server. After looking up the logs, I found these messages:
/app/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/library.rb:145:in 
`block in ffi_lib': Could not open library 'vips.so.42': vips.so.42: 
cannot open shared object file: No such file or directory. (LoadError)

app[web.1]: Could not open library 'libvips.so.42': 
libvips.so.42: cannot open shared object file: No such file or directory
Does this mean we need to add a libvips buildpack on Heroku?
Aska Konomi
After some tests, it seems we do need to add libvips to Heroku buildpacks, otherwise the app will crash when users updated their avatar. Maybe the install docs needs to be updated to reflect this change?

Just in case someone runs into the same issue, I will leave the steps here:

1. Add the apt buildpack
heroku buildpacks:add --index 1 heroku-community/apt
2. Create a file named Aptfile in the app root
3. Edit the aptfile with content
libglib2.0-0
libglib2.0-dev
libpoppler-glib8
4. Add the libvips buildpack to the bottom of the buildpacks
heroku buildpacks:add --index 4 https://github.com/brandoncc/heroku-buildpack-vips
5. Push to Heroku again, and the libvips should work.
John Joubert
 any chance we can document this somewhere? I run into this issue and the above solved for me too. Happy to open a PR in the GitHub repo if that helps?
Very helpful! Thanks
Aska Konomi
The app frequently crashes on our Heroku production server. After looking up the logs, I found these messages:
/app/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/library.rb:145:in 
`block in ffi_lib': Could not open library 'vips.so.42': vips.so.42: 
cannot open shared object file: No such file or directory. (LoadError)

app[web.1]: Could not open library 'libvips.so.42': 
libvips.so.42: cannot open shared object file: No such file or directory
Does this mean we need to add a libvips buildpack on Heroku?
Aska Konomi
After some tests, it seems we do need to add libvips to Heroku buildpacks, otherwise the app will crash when users updated their avatar. Maybe the install docs needs to be updated to reflect this change?

Just in case someone runs into the same issue, I will leave the steps here:

1. Add the apt buildpack
heroku buildpacks:add --index 1 heroku-community/apt
2. Create a file named Aptfile in the app root
3. Edit the aptfile with content
libglib2.0-0
libglib2.0-dev
libpoppler-glib8
4. Add the libvips buildpack to the bottom of the buildpacks
heroku buildpacks:add --index 4 https://github.com/brandoncc/heroku-buildpack-vips
5. Push to Heroku again, and the libvips should work.
John Joubert
 any chance we can document this somewhere? I run into this issue and the above solved for me too. Happy to open a PR in the GitHub repo if that helps?
Very helpful! Thanks
Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC