I’m having trouble with Puppeteer in my Node.js app. It works fine when I’m connected via SSH, but once the connection drops, it stops working. Here’s what happens:
After generating a few PDFs successfully, I get this error:
Error: Failed to launch the browser process!
cmd_run.go:1285: WARNING: cannot start document portal: dial unix /run/user/1000/bus: connect: no such file or directory
/system.slice/pm2-ubuntu.service is not a snap cgroup
I’m using a bunch of launch options for Puppeteer, like disabling various features and setting up a custom user data directory. Has anyone run into this issue or know how to keep Puppeteer running smoothly even when the SSH session ends?
It’s really bugging me because I need this to work reliably for my PDF generation process. Any ideas on what might be causing this or how to fix it would be super helpful!
hey man, i had the same issue. try using nohup to run ur app in the background. it keeps it going even when ssh dies. also, check ur firewall settings. sometimes they mess with puppeteer. oh and make sure ur using the latest version of puppeteer. older ones can be buggy af. good luck bro!
I’ve encountered similar issues with Puppeteer on remote servers. The problem likely stems from the browser process being tied to your SSH session. To resolve this, you might want to consider running your Node.js app using a process manager like PM2 or screen.
These tools allow your application to continue running even after you disconnect from SSH. Additionally, ensure you’re launching Puppeteer with the ‘–no-sandbox’ flag and possibly ‘–disable-setuid-sandbox’ for better compatibility in headless environments.
If you’re still facing issues, you could try using a virtual framebuffer like Xvfb. This creates a virtual display that Puppeteer can use, which might help in situations where the SSH connection is unstable.
Lastly, double-check your server’s resource allocation. Sometimes, these errors can occur if the system is running low on memory or CPU power, especially when generating multiple PDFs concurrently.
Hey there, I’ve dealt with similar Puppeteer headaches before. One thing that worked for me was running the Node.js app as a systemd service. This keeps it going even when SSH drops.
Also, make sure you’re using the ‘–disable-dev-shm-usage’ flag when launching the browser. Sometimes the /dev/shm partition is too small on cloud servers, causing Puppeteer to crash.
If you’re still having trouble, you might want to look into using a headless browser service like Browserless. It takes care of a lot of these infrastructure headaches for you.
Lastly, check your server’s ulimit settings. If it’s set too low, it can cause issues with Puppeteer spawning new processes. Bump it up and see if that helps.
Hope this gives you some new angles to tackle the problem. Good luck!