R
Railway16mo ago
patd0

I cannot seem to get Puppeteer running on node.

So I modified my nixpacks to use node 18.16.
[phases.setup]
nixpkgsArchive = '4ecab3273592f27479a583fb6d975d4aba3486fe'
[phases.setup]
nixpkgsArchive = '4ecab3273592f27479a583fb6d975d4aba3486fe'
I'm using :
this.browser = await puppeteer.launch({
headless: "new",
args: ["--no-sandbox", "--disable-setuid-sandbox"],
ignoreDefaultArgs: ['--disable-extensions']
});
this.browser = await puppeteer.launch({
headless: "new",
args: ["--no-sandbox", "--disable-setuid-sandbox"],
ignoreDefaultArgs: ['--disable-extensions']
});
But I keep getting this error:
file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:268
reject(new Error([
^
Error: Failed to launch the browser process! undefined
[19:19:0813/053526.608441:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:268:24)
at ChildProcess.emit (node:events:525:35)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Node.js v18.16.0
file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:268
reject(new Error([
^
Error: Failed to launch the browser process! undefined
[19:19:0813/053526.608441:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///app/node_modules/@puppeteer/browsers/lib/esm/launch.js:268:24)
at ChildProcess.emit (node:events:525:35)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
Node.js v18.16.0
Although we can clearly see that the --no-sandbox flag is being passed. package.json:
"puppeteer": "^20.7.2"
"puppeteer": "^20.7.2"
If anyone could help out.
Solution:
Finally, I think using browserless might be the easiest solution 🙂
Jump to solution
7 Replies
Percy
Percy16mo ago
Project ID: 1d5edfc1-e62a-4374-b521-39406854b371
patd0
patd0OP16mo ago
1d5edfc1-e62a-4374-b521-39406854b371 FYI, I've also tried the nixpacks:
[phases.setup]
nixpkgsArchive = '4ecab3273592f27479a583fb6d975d4aba3486fe'
aptPkgs = [
'fonts-liberation',
'libappindicator3-1',
'libasound2',
'libatk-bridge2.0-0',
'libatk1.0-0',
'libgbm1',
'libgtk-3-0',
'libnspr4',
'libnss3',
'libx11-xcb1',
'libxcomposite1',
'libxcursor1',
'libxdamage1',
'libxfixes3',
'libxi6',
'libxrandr2',
'libxss1',
'libxtst6',
'xdg-utils'
]
[phases.setup]
nixpkgsArchive = '4ecab3273592f27479a583fb6d975d4aba3486fe'
aptPkgs = [
'fonts-liberation',
'libappindicator3-1',
'libasound2',
'libatk-bridge2.0-0',
'libatk1.0-0',
'libgbm1',
'libgtk-3-0',
'libnspr4',
'libnss3',
'libx11-xcb1',
'libxcomposite1',
'libxcursor1',
'libxdamage1',
'libxfixes3',
'libxi6',
'libxrandr2',
'libxss1',
'libxtst6',
'xdg-utils'
]
Fragly
Fragly16mo ago
Do you have chrome installed on the docker image?
Fragly
Fragly16mo ago
Also, just saying this since puppeteer is basically synonymous with userbots ( but I know it has other usecases ) railway doesn't allow userbots on their platform ( https://railway.app/legal/fair-use for more info )
Railway
Fair Use
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Fragly
Fragly16mo ago
just in case you happen to be running something similar ^
patd0
patd0OP16mo ago
Right, but. Not its not. Its to run a playcanvas instance. Puppeteer does install chrome when installed by yarn.
Solution
patd0
patd016mo ago
Finally, I think using browserless might be the easiest solution 🙂
Want results from more Discord servers?
Add your server