wicked_pdf icon indicating copy to clipboard operation
wicked_pdf copied to clipboard

PDF Rendering Fail on Heroku-24 Stack

Open CarlosAwo opened this issue 6 months ago • 5 comments

Issue description

When attempting to generate a PDF using wicked_pdf with wkhtmltopdf on Heroku, the process fails with a 500 Internal Server Error. The logs indicate that the issue is related to the wkhtmltopdf executable failing to load a required shared library (libssl.so.1.1).

The specific error message from the logs is:

RuntimeError (Failed to execute: ["/app/vendor/bundle/ruby/3.2.0/gems/wkhtmltopdf-heroku-2.12.6.0/bin/wkhtmltopdf-linux-amd64", "--orientation", "Landscape", "--header-left", "Rapport", "--header-right", "Report ", "--header-font-size", "8", "--footer-left", "Généré depuis App Name, le 29/07/2024", "--footer-right", "Page [page]/[topage]", "--footer-font-size", "8", "file:////tmp/wicked_pdf20240729-2-op1664.html", "/tmp/wicked_pdf_generated_file20240729-2-ew0j4z.pdf"] Error: PDF could not be generated! Command Error: /app/vendor/bundle/ruby/3.2.0/gems/wkhtmltopdf-heroku-2.12.6.0/bin/wkhtmltopdf-linux-amd64: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Expected or desired behavior

The PDF should be generated successfully without encountering shared library errors. The expected behavior is for wkhtmltopdf to be able to generate the PDF with the provided parameters and template.

System specifications wicked_pdf gem version: wicked_pdf (2.6.3) wicked_pdf

Platform/distribution and version:

Heroku / Cedar-20 Current BuildPack: https://github.com/RohanDebroy/heroku-buildpack-wkhtmltopdf.git

Additional context

The issue appears to be related to missing dependencies in the wkhtmltopdf binary. The library libssl.so.1.1 is required but not present in the Heroku environment.

Is there a recommended way to ensure that libssl.so.1.1 is available, or is there an alternative version of wkhtmltopdf that does not have this dependency? Any guidance on resolving this would be appreciated.

CarlosAwo avatar Aug 22 '24 12:08 CarlosAwo