CDLUC3 / dmptool

DMPTool version of the DMPRoadmap codebase
https://dmptool.org
MIT License
56 stars 13 forks source link

PDF downloads not working in the AWS Linux 2023 #553

Closed briri closed 3 months ago

briri commented 3 months ago

The new AWS Linux 2023 servers are throwing errors when you try to generate a PDF download. Seems to be a missing C package.

I, [2024-03-21T07:39:43.335821 #1143018]  INFO -- : [2a99c89e-5770-4d8b-adc4-09e872b89a4d] Completed 500 Internal Server Error in 1803ms (ActiveRecord: 998.0ms | Allocations: 29468)
F, [2024-03-21T07:39:43.336458 #1143018] FATAL -- : [2a99c89e-5770-4d8b-adc4-09e872b89a4d]   
[2a99c89e-5770-4d8b-adc4-09e872b89a4d] RuntimeError (Failed to execute:
["/apps/dmp/apps/dmptool/releases/20240320234903/bin/wkhtmltopdf", "--page-size", "Letter", "--margin-top", "25", "--margin-bottom", "25", "--margin-left", "25", "--margin-right", "25", "file:////tmp/wicked_pdf20240321-1143018-28zpe1.html", "/tmp/wicked_pdf_generated_file20240321-1143018-ezcy9p.pdf"]
Error: PDF could not be generated!
 Command Error: pid 1192298 exit 127
/apps/dmp/apps/dmptool/shared/bundle/ruby/3.2.0/gems/wkhtmltopdf-binary-0.12.6.6/bin/wkhtmltopdf_centos_6_amd64: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

The wkhtmtopdf-binary gem repository has an outstanding issue for this that has been open since December 2023.

This is related to the fact that the wkhtmltopdf package does not have an AWS Linux 2023 build: https://wkhtmltopdf.org/downloads.html

wimpog commented 5 days ago

@briri I see this issue is marked as "completed on Apr 3". I'm still facing this issue. Any updates on it?

bofstein commented 5 days ago

@briri I see this issue is marked as "completed on Apr 3". I'm still facing this issue. Any updates on it?

@wimpog can you please share more details and screenshots of exactly what you were seeing?

wimpog commented 5 days ago

@bofstein :

Platform: Ruby 3.2 running on 64bit Amazon Linux 2023/4.0.8

var/app/current/vendor/bundle/ruby/3.2.0/gems/wkhtmltopdf-binary-0.12.6.7/bin/wkhtmltopdf /var/app/current/vendor/bundle/ruby/3.2.0/gems/wkhtmltopdf-binary-0.12.6.7/bin/wkhtmltopdf_centos_6_amd64: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

As described here: https://github.com/zakird/wkhtmltopdf_binary_gem/issues/161

When running it via Sidekiq:

RuntimeError: Failed to execute: ["/var/app/current/vendor/bundle/ruby/3.2.0/gems/wkhtmltopdf-binary-0.12.6.7/bin/wkhtmltopdf", "--page-size", "Letter", "file:////tmp/wicked_pdf20240701-482194-7a7csw.h...

Thank you!

bofstein commented 5 days ago

@wimpog are you experiencing this on the production environment DMP Tool or in some other app or project? We closed this issue because we replaced wkhtmltopdf and are no longer using it due to this issue.

wimpog commented 5 days ago

@bofstein do you have any recommendations as to what to use instead of wkhtmltopdf?

bofstein commented 5 days ago

@wimpog here is the ticket for our replacement if any of the comments or notes are helpful to you, I don't have a specific recommendation

https://github.com/CDLUC3/dmptool/issues/604

briri commented 5 days ago

Hi @wimpog, as @bofstein notes above, issue 604 contains the details of the code changes we needed to make to switch to the Grover gem (node's Puppeteer with headless Chrome under the hood).

For some context on how to get puppeteer and chrome installed in your environment, you can reference this ticket in the amazon-linux-2023 repo