c++ Puppeteer崩溃,无法在Heroku/节点上启动

hyrbngr7  于 2023-03-14  发布在  其他
关注(0)|答案(1)|浏览(183)

错误:

Error: Failed to launch the browser process!
[0308/160348.160570:ERROR:headless_shell.cc(205)] Headless commands are not compatible with remote debugging.

构建包:https://github.com/jontewks/puppeteer-heroku-buildpack#22.0.0
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)

搜索错误只会显示以下内容:https://chromium.googlesource.com/chromium/src.git/+/master/headless/app/headless_shell.cc
姓名首字母:

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"),
};

我试过的 puppet 剧版本:

19.7.2
18.1.0
17.1.3
x8goxv8g

x8goxv8g1#

删除"--print-to-pdf-no-header"修复了我的问题

相关问题