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 rendering fails on Heroku 18 Stack #741

Open
PercyWoeds opened this issue May 28, 2018 · 8 comments
Open

PDF rendering fails on Heroku 18 Stack #741

PercyWoeds opened this issue May 28, 2018 · 8 comments

Comments

@PercyWoeds
Copy link

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

@jamesinjapan
Copy link

jamesinjapan commented May 31, 2018

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:in rescue 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:in pdf_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.

@jamesinjapan
Copy link

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.

@unixmonkey unixmonkey changed the title PDF rendering fails in production PDF rendering fails on Heroku 18 Stack Jun 4, 2018
@simonc
Copy link

simonc commented Nov 11, 2018

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.

@unixmonkey
Copy link
Collaborator

@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?

@simonc
Copy link

simonc commented Nov 13, 2018

@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.

@JonEastman
Copy link

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

@kpheasey
Copy link

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'

@kreintjes
Copy link

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

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

7 participants