Heroku/Node环境下Puppeteer启动崩溃问题求助
Heroku/Node环境下Puppeteer启动浏览器进程崩溃求助
报错信息
Error: Failed to launch the browser process!
[0308/160348.160570:ERROR:headless_shell.cc(205)] Headless commands are not compatible with remote debugging.
使用的Buildpack
https://github.com/jontewks/puppeteer-heroku-buildpack#22.0.0
Chrome路径验证操作及结果
执行命令确认Google Chrome位置,输出如下:
heroku run bash --app XXXX --type=worker ~ $ find ./ -name google-chrome ./.apt/etc/cron.daily/google-chrome ./.apt/opt/google/chrome/google-chrome ./.apt/opt/google/chrome/cron/google-chrome ~ $ /app/.apt/opt/google/chrome/google-chrome [12:12:0308/131028.130068:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /app/.apt/opt/google/chrome/chrome-sandbox is owned by root and has mode 4755. [0308/131028.130389:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Permission denied (13) Trace/breakpoint trap ~ $ [25:25:0100/000000.159168:ERROR:zygote_linux.cc(661)] write: Broken pipe (32)
Puppeteer初始化代码
const Puppeteer = require("puppeteer"); const browser = await Puppeteer.launch({ headless: true, ignoreHTTPSErrors: true, args: ["--no-sandbox", "--print-to-pdf-no-header"], executablePath: "/app/.apt/opt/google/chrome/google-chrome", });
Puppeteer配置文件
const {join} = require("path"); /** * @type {import("puppeteer").Configuration} */ module.exports = { // Changes the cache location for Puppeteer. cacheDirectory: join(__dirname, ".cache", "puppeteer"), };
已尝试的Puppeteer版本
- 19.7.2
- 18.1.0
- 17.1.3
现寻求该问题的解决方案。
内容的提问来源于stack exchange,提问作者lewicki
相关产品推荐
相关产品推荐

