Tag: cedar

在Heroku上使用PDFKit生成文件 – 没有这样的文件或目录

我正在使用PDFKit从Heroku Cedar上的Resque作业中的给定URL创建pdf。 我的代码看起来像: kit = PDFKit.new(url) pdf = kit.to_file(“/tmp/#{SecureRandom.hex}.pdf”) 然后我使用雾将文件上传到S3以进行永久存储。 这项工作通常有效,但也可能在三分之一的时间内失败: No such file or directory – /tmp/a05c165fc80878b75fd15c447695de71.pdf 手动运行控制台中的代码将产生相同的错误。 根据Heroku文档,我应该能够在Cedar的应用程序目录中的任何位置编写临时文件。 我已经尝试首先创建tmp目录(在控制台中),但似乎没有改变任何东西。 也没有保存到“#{Rails.root} / tmp /#{SecureRandom.hex} .pdf”。 任何想法将不胜感激。 UPDATE 控制台中的完整错误是: Error: Failed loading page http://grist.org/living/you-look-great-in-green-clothing-industry-gets-a-makeover-maybe.html (sometimes it will work just to ignore this error with –load-error-handling ignore) Errno::ENOENT: No such file or directory – /tmp/55a1d418074736decfd4e123d8e2bba2.pdf 似乎这可能是来自wkhtmltopdf的错误,但是,如果我通过PDFkit使用wkhtmltopdf,我不知道在哪里添加此标志。