Wicked_pdf: PDF rendering fails on Heroku 18 Stack

Created on 28 May 2018  Â·  8Comments  Â·  Source: mileszs/wicked_pdf

I have one problem PDF rendering works in development but not in production environment. The following error gets logged in "log/production.log"
I worked with heroku

2018-05-28T16:12:04.127157+00:00 app[web.1]: RuntimeError (Failed to execute:
2018-05-28T16:12:04.127159+00:00 app[web.1]: ["/app/vendor/bundle/ruby/2.4.0/bin/wkhtmltopdf", "-q", "file:////tmp/wicked_pdf20180528-4-1n6idpw.html", "/tmp/wicked_pdf_generated_file20180528-4-e58bir.pdf"]
2018-05-28T16:12:04.127161+00:00 app[web.1]: Error: PDF could not be generated!
2018-05-28T16:12:04.127163+00:00 app[web.1]: Command Error: ):
2018-05-28T16:12:04.127165+00:00 app[web.1]: app/controllers/facturas_controller.rb:25:in `reportes'
2018-05-28T16:12:04.127167+00:00 app[web.1]:
2018-05-28T16:12:04.127168+00:00 app[web.1]:
2018-05-28T16:12:04.284318+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=appvaluemi.herokuapp.com request_id=76e488db-f65e-46a0-ba95-02173902be1c fwd="" dyno=web.1 connect=0ms service=3ms status=304 bytes=62 protocol=http

in heroku i worked with
Rails 4.2.8
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]

This problem started with change ruby 2.3 to ruby 2.4.4 in heroku

Please anyone help me

Thanks in advance.
Percy

wkhtmltopdf

Most helpful comment

I reverted my stack to heroku-16 (cedar-14 is deprecated) using "heroku stack:set heroku-14" and pushed a new deployment. That worked for me.

More about changing your stack here.

All 8 comments

I am having a similar issue. Today I had to update my Ruby version because Heroku's deployments were failing. I went with 2.4.4 (and I'm now trying 2.4.0) to the same effect.

Nothing has changed in my application for this process except updated Ruby. My error log has:
"/app/vendor/bundle/ruby/2.4.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:91:inrescue in pdf_from_url'", "/app/vendor/bundle/ruby/2.4.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:94:in pdf_from_url'", "/app/vendor/bundle/ruby/2.4.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:49:inpdf_from_html_file'", "/app/vendor/bundle/ruby/2.4.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:60:in pdf_from_string'",

I have also moved the PDF generation out from an asynchronous process to see if that had any effect. It did not.

I'm using Rails 5.1.4 on a heroku-18 stack.

EDIT: I checked my rollback data and I was on a cedar-14 stack until I pushed this morning, so I'm going to hazard a guess that this is due to Heroku upgrading to a new stack.

I reverted my stack to heroku-16 (cedar-14 is deprecated) using "heroku stack:set heroku-14" and pushed a new deployment. That worked for me.

More about changing your stack here.

Hi there. I don't know if it's related but switching from heroku-16 to heroku-18 PDF keep generating but images are not loading. I confirmed by switching back and it worked again.

@simonc are you using the stack posted above, or something else? Is the issue only images over https? Which helpers are you using, and is this ActiveStorage or something else? What versions of WickedPDF, wkhtmltopdf, Rails, and whatever wkhtmltopdf gem you might be using?

@unixmonkey the stack we use is the following one:
• Ruby 2.5.1
• Rails 5.2.0
• WickedPDF 1.1.0
• wkhtmltopdf 0.12.3 (through dscout/wkhtmltopdf-buildpack)

You're right though, it only concerns HTTPS pics so I guess my issue is more related to #344 even though the behavior changes between heroku-16 and heroku-18.

Hey guys, did you find a solution to this problem? I am having the same issue now.

Just confirming that reverting from heroku-18 to heroku-16 fixed the HTTPS image rendering problem for me.

# ./Gemfile
...
gem 'wkhtmltopdf-binary', '0.12.4', group: %i[development test]
gem 'wkhtmltopdf-heroku', '2.12.4.0', group: :production
gem 'wicked_pdf', '1.2.1'

Same problem as @simonc over here. Everything was fine with heroku-16, but with heroku-18 images (from AWS) won't render any longer.

UPDATE: installing the libssl1.0.0 apt package on Heroku (using the heroku-community/apt buildpack) fixes the problem. See https://razorjack.net/wkhtmltopdf-on-heroku-evaluating-different-installation-options/ for details. @kpheasey @JonEastman @simonc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomasbalsloev picture thomasbalsloev  Â·  3Comments

gregblass picture gregblass  Â·  4Comments

kavitakanojiya picture kavitakanojiya  Â·  5Comments

supriyas12 picture supriyas12  Â·  4Comments

lisamburns picture lisamburns  Â·  3Comments