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

PDF downloads not working in the AWS Linux 2023 #553

Closed
briri opened this issue Mar 21, 2024 · 7 comments
Closed

PDF downloads not working in the AWS Linux 2023 #553

briri opened this issue Mar 21, 2024 · 7 comments
Assignees

Comments

@briri
Copy link
Collaborator

briri commented Mar 21, 2024

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
Copy link

wimpog commented Jul 1, 2024

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

@bofstein
Copy link
Collaborator

bofstein commented Jul 1, 2024

@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
Copy link

wimpog commented Jul 1, 2024

@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: zakird/wkhtmltopdf_binary_gem#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
Copy link
Collaborator

bofstein commented Jul 1, 2024

@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
Copy link

wimpog commented Jul 1, 2024

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

@bofstein
Copy link
Collaborator

bofstein commented Jul 1, 2024

@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

#604

@briri
Copy link
Collaborator Author

briri commented Jul 1, 2024

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

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

No branches or pull requests

3 participants