puppeteer: [Bug]: Failed to launch the browser process when headless set to "new"
Minimal, reproducible example
const puppeteer = require("puppeteer");
const paths = process.cwd() + "/extension";
(async () => {
const browser = await puppeteer.launch({
headless: "new",
args: ["--no-sandbox",
"--disable-setuid-sandbox",
`--disable-extensions-except=${paths}`,
`--load-extension=${paths}`],
userDataDir: "./tmp",
});
const page = await browser.newPage();
await page.goto("https://www.google.com/");
})();
Error string
Failed to launch the browser process! undefined
Bug behavior
- Flaky
Background
i’ve been trying to run puppeteer with headless “new” because headless true will be deprecated soon
Expectation
it will run properly
Reality
it’s not , it crash and show the error like this
Error: Failed to launch the browser process! undefined
[27051:27051:0707/132159.274812:ERROR:process_singleton_posix.cc(334)] Failed to create /home/fdciabdul/PROJECT/fbchat/tmp/SingletonLock: File exists (17)
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (/home/fdciabdul/PROJECT/fbchat/node_modules/@puppeteer/browsers/lib/cjs/launch.js:259:24)
at ChildProcess.emit (node:events:525:35)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Node.js v18.14.2
but when i set headless to false
it’s work
Puppeteer configuration
No response
Puppeteer version
20.7.4
Node version
18.14.2
Package manager
npm
Package manager version
9.5.0
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 40 (5 by maintainers)
making unique userdatadir is not what i want , because in here i wanna save the session
This is being fixed in https://bugs.chromium.org/p/chromium/issues/detail?id=1463328 The fix is on the Chromium side and it is expected to roll out in M119.
tested with puppeteer@21.4.0 and still happening
@virtuallyunknown @Kikobeats @fdciabdul fixed in 21.5.0
The latest version of Puppeteer at the time of writing this comment is
21.4.1
which comes with ChromeChrome/118.0.5993.70
so the problem is still present.I still have the same issue with v21.5.1 and v21.5.0
using different folders for userDataDir suggested here fixes the issue
I upgraded version to
21.5.0
, tested it now, I confirm that the issue is fixed.that’s not solution
When can we expect puppeteer to download / install M119? I’m not sure how puppeteer decides on its latest version. Is it when the version is considered stable by google i.e When the stable date is hit on this https://chromiumdash.appspot.com/schedule ?
Looks like this happens if the browser is not closed via
browser.close
and instead killed via the process termination.