WickedPDF in Docker sometimes fails generating a PDF attachment

我与影子孤独终老i 提交于 2020-03-25 16:00:11

问题


I have a local Rails app that utilizes WickedPDF for some PDF generation in a Sidekiq job. When I run my app locally, it works just fine and all my RSpec tests pass. When I try to spin up the app in a Docker container, there's some strange behavior:

The Sidekiq jobs occassionally fail with an error and go back in to the "retry" queue. Over time, they all eventually get successfully processed, but it takes a lot of failed (expensive) attempts to do so. Is there any way to fix the error below, to prevent these errors from occuring?


RuntimeError: Failed to execute: ["/usr/bin/wkhtmltopdf", "--margin-top", "30", "--margin-bottom", "10", "file:////tmp/wicked_pdf20200221-1-170ippe.html", "/tmp/wicked_pdf_generated_file20200221-1-aikfq3.pdf"] 
Error: PDF could not be generated! Command Error: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

来源:https://stackoverflow.com/questions/60334567/wickedpdf-in-docker-sometimes-fails-generating-a-pdf-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!