Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFs not working unless I add poppler-utils to Aptfile #24

Closed
oskargargas opened this issue Apr 27, 2022 · 1 comment
Closed

PDFs not working unless I add poppler-utils to Aptfile #24

oskargargas opened this issue Apr 27, 2022 · 1 comment

Comments

@oskargargas
Copy link

Hi!

I have problems rendering PDFs in current setup on Heroku-20. It was fixed after I added poppler-utils to the Aptfile though not sure if this is recommended solution.

Regards,
Oskar

Aptfile

libglib2.0-0
libglib2.0-dev
libpoppler-glib8

Heroku log:

2022-04-27T08:35:47.163898+00:00 app[web.1]: I, [2022-04-27T08:35:47.163840 #4]  INFO -- : [d02f7f62-3b26-440c-a691-4e49980b8f90] Started GET "/documents" for *.*.*.* at 2022-04-27 08:35:47 +0000
2022-04-27T08:35:47.165023+00:00 app[web.1]: I, [2022-04-27T08:35:47.164969 #4]  INFO -- : [d02f7f62-3b26-440c-a691-4e49980b8f90] Processing by DocumentsController#index as */*
2022-04-27T08:35:47.253304+00:00 app[web.1]: I, [2022-04-27T08:35:47.253231 #4]  INFO -- : [d02f7f62-3b26-440c-a691-4e49980b8f90]   Rendered documents/index.jbuilder (Duration: 32.0ms | Allocations: 10605)
2022-04-27T08:35:47.253516+00:00 app[web.1]: I, [2022-04-27T08:35:47.253484 #4]  INFO -- : [d02f7f62-3b26-440c-a691-4e49980b8f90] Completed 500 Internal Server Error in 88ms (ActiveRecord: 16.6ms | Allocations: 13216)
2022-04-27T08:35:47.254363+00:00 app[web.1]: F, [2022-04-27T08:35:47.254328 #4] FATAL -- : [d02f7f62-3b26-440c-a691-4e49980b8f90]   
2022-04-27T08:35:47.254364+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90] ActionView::Template::Error (ActiveStorage::UnrepresentableError):
2022-04-27T08:35:47.254365+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]      9: json.file do
2022-04-27T08:35:47.254365+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     10:   json.child! do
2022-04-27T08:35:47.254365+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     11:     json.size "thumb"
2022-04-27T08:35:47.254366+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     12:     json.url document.file.representation(resize_to_limit: [200, 200]).processed.url
2022-04-27T08:35:47.254367+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     13:   end
2022-04-27T08:35:47.254367+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     14:   json.child! do
2022-04-27T08:35:47.254367+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]     15:     json.size "medium"
2022-04-27T08:35:47.254368+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90]   
2022-04-27T08:35:47.254368+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90] app/views/documents/_document.jbuilder:12
2022-04-27T08:35:47.254368+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90] app/views/documents/_document.jbuilder:10
2022-04-27T08:35:47.254369+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90] app/views/documents/_document.jbuilder:9
2022-04-27T08:35:47.254369+00:00 app[web.1]: [d02f7f62-3b26-440c-a691-4e49980b8f90] app/views/documents/index.jbuilder:1

Herok build log:

-----> Building on the Heroku-20 stack
-----> Using buildpacks:
       1. https://github.com/heroku/heroku-buildpack-apt
       2. https://github.com/brandoncc/heroku-buildpack-vips
       3. heroku/ruby
-----> Apt app detected
-----> Detected Aptfile or Stack changes, flushing cache
-----> Updating apt caches
       Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
       Get:2 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
       Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
       Hit:4 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
       Get:5 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,155 kB]
       Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,188 kB]
       Fetched 3,571 kB in 1s (3,854 kB/s)
       Reading package lists...
-----> Fetching .debs for libglib2.0-0
       Reading package lists...
       Building dependency tree...
       0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 15 not upgraded.
       Need to get 1,287 kB of archives.
       After this operation, 0 B of additional disk space will be used.
       Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libglib2.0-0 amd64 2.64.6-1~ubuntu20.04.4 [1,287 kB]
       Fetched 1,287 kB in 0s (11.2 MB/s)
       Download complete and in download only mode
-----> Fetching .debs for libglib2.0-dev
       Reading package lists...
       Building dependency tree...
       0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 15 not upgraded.
       Need to get 1,506 kB of archives.
       After this operation, 0 B of additional disk space will be used.
       Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libglib2.0-dev amd64 2.64.6-1~ubuntu20.04.4 [1,506 kB]
       Fetched 1,506 kB in 0s (12.3 MB/s)
       Download complete and in download only mode
-----> Fetching .debs for libpoppler-glib8
       Reading package lists...
       Building dependency tree...
       The following additional packages will be installed:
         libnspr4 libnss3 libpoppler97
       The following NEW packages will be installed:
         libnspr4 libnss3 libpoppler-glib8 libpoppler97
       0 upgraded, 4 newly installed, 0 to remove and 15 not upgraded.
       Need to get 2,388 kB of archives.
       After this operation, 8,363 kB of additional disk space will be used.
       Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libnspr4 amd64 2:4.25-1 [107 kB]
       Get:2 http://archive.ubuntu.com/ubuntu focal-security/main amd64 libnss3 amd64 2:3.49.1-1ubuntu1.6 [1,256 kB]
       Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libpoppler97 amd64 0.86.1-0ubuntu1 [915 kB]
       Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libpoppler-glib8 amd64 0.86.1-0ubuntu1 [109 kB]
       Fetched 2,388 kB in 1s (2,890 kB/s)
       Download complete and in download only mode
-----> Installing libglib2.0-0_2.64.6-1~ubuntu20.04.4_amd64.deb
-----> Installing libglib2.0-dev_2.64.6-1~ubuntu20.04.4_amd64.deb
-----> Installing libnspr4_2%3a4.25-1_amd64.deb
-----> Installing libnss3_2%3a3.49.1-1ubuntu1.6_amd64.deb
-----> Installing libpoppler97_0.86.1-0ubuntu1_amd64.deb
-----> Installing libpoppler-glib8_0.86.1-0ubuntu1_amd64.deb
-----> Writing profile script
-----> Rewrite package-config files
-----> vips (heroku-20 stack) app detected
-----> Vendoring binaries
       Fetching /tmp/codon/tmp/buildpacks/9d9d827d88c1c1e37cae04f38ca711f444f443aa/build/heroku-20.tar.gz
-----> Configuring build environment
-----> Building runtime environment
-----> Ruby app detected
-----> Installing bundler 2.3.10
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.1.2
-----> Installing dependencies using bundler 2.3.10
@brandoncc
Copy link
Contributor

Interesting, thanks for sharing this. The long term plan is to switch PDF providers to PDFium, so hopefully this issue will resolve itself. In the meantime, the issue is here to help anyone else if they experience the same issue. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants