Mat*_*ssi 6 wkhtmltopdf google-cloud-functions
我正在尝试在 GCF 上使用 wkhtmltopdf 来生成 PDF。当我的函数尝试生成子进程时,出现以下错误:
Error: ./services/wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or director
Run Code Online (Sandbox Code Playgroud)
该问题显然是由于 wkhtmltopdf 二进制文件依赖于未安装在 GCF 环境中的外部共享库。
有没有办法解决这个问题,或者我应该放弃并使用其他解决方案(AWS Lambda o GAE)?先感谢您
事实上,我\xe2\x80\x99ve找到了一种解决这个问题的方法,通过将所有必需的库复制到包含wkhtmltopdf二进制文件的同一文件夹(对我来说是/bin)中。为了让二进制文件使用上传的库,我在 wkhtmltopdf.js 中添加了以下几行:\nwkhtmltopdf.command = 'LD_LIBRARY_PATH='+path.resolve(__dirname, 'bin')+' ./bin/wkhtmltopdf';\ nwkhtmltopdf.shell = '/bin/bash';\nmodule.exports = wkhtmltopdf;
\n\n有一段时间一切都运转良好。突然间,我收到了许多来自 GCF 的连接错误或超时,但我认为它\xe2\x80\x99s 与我的实现无关,而是与 Google 相关。\n我\xe2\x80\x99ve 最终设置了一个专用服务器。
\n| 归档时间: |
|
| 查看次数: |
4099 次 |
| 最近记录: |