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 3 years ago
- Reactions: 10
- Comments: 52 (5 by maintainers)
making unique userdatadir is not what i want , because in here i wanna save the session
tested with puppeteer@21.4.0 and still happening
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.
@virtuallyunknown @Kikobeats @fdciabdul fixed in 21.5.0
The latest version of Puppeteer at the time of writing this comment is
21.4.1which comes with ChromeChrome/118.0.5993.70so the problem is still present.that’s not solution
Another way to avoid this is ensuring user data is unique:
Passing the flag:
So even the browser is not gracefully browser, a new browser spawn will have associated a different folder.
On the other hand, even using
browser.closethe directory is not cleaned, so that is clearly buggy.Looks like this happens if the browser is not closed via
browser.closeand instead killed via the process termination.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.I’m sorry everyone
Fix: sudo apt-get update sudo apt-get install -y libgbm-dev
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 ?