Reputation: 55
I am using the gem 'wicked_pdf' to convert html to pdf. It is working fine in the development mode. but in the production it is throwing an error by nginx.This is the error log in the production:
I, [2017-10-17T12:34:09.726920 #17004] INFO -- : [4a94b9f6-fdf6-4e55-b325-9b3096132d4e] Completed 500 Internal Server Error in 2638ms (ActiveRecord: 30.6ms)
F, [2017-10-17T12:34:09.729566 #17004] FATAL -- : [4a94b9f6-fdf6-4e55-b325-9b3096132d4e]
F, [2017-10-17T12:34:09.729763 #17004] FATAL -- : [4a94b9f6-fdf6-4e55-b325-9b3096132d4e] RuntimeError (Failed to execute:
["/home/deploy/phoenix/shared/bundle/ruby/2.4.0/bin/wkhtmltopdf", "-q", "file:////tmp/wicked_pdf20171017-17004-ps7ahv.html", "/tmp/wicked_pdf_generated_file20171017-17004-17rkfch.pdf"]
Error: PDF could not be generated!
Command Error: /home/deploy/phoenix/shared/bundle/ruby/2.4.0/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_amd64: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory
):
F, [2017-10-17T12:34:09.729900 #17004] FATAL -- : [4a94b9f6-fdf6-4e55-b325-9b3096132d4e]
F, [2017-10-17T12:34:09.730005 #17004] FATAL -- : [4a94b9f6-fdf6-4e55-b325-9b3096132d4e] app/controllers/orders_controller.rb:16:in `block (2 levels) in show'
[4a94b9f6-fdf6-4e55-b325-9b3096132d4e] app/controllers/orders_controller.rb:13:in `show'
I gussed that I have an issue with missing lib: libXrender.so.1
I am using on the production ubuntu 16.04 ruby:2.4.1 and rails 5.1.4 Can I get your support please?
Upvotes: 2
Views: 2041
Reputation: 18784
It sounds like your production server doesn't have an xserver installed.
sudo apt-get install libxrender1
should work for you on Ubuntu.
Upvotes: 6