I’m encountering a strange problem with my Node.js application that uses Puppeteer to generate PDF documents from web pages. It operates perfectly while I’m connected via SSH, but once the SSH session is closed, Puppeteer starts giving me errors after successfully creating a few PDFs.
Here’s the error that appears:
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
Below is my Puppeteer configuration:
const chromeInstance = await puppeteer.launch({
headless: "new",
userDataDir: "./cache/" + sessionId,
executablePath: process.env.CHROME_PATH,
args: [
'--disable-features=IsolateOrigins',
'--disable-site-isolation-trials',
'--autoplay-policy=user-gesture-required',
'--disable-background-networking',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-breakpad',
'--disable-client-side-phishing-detection',
'--disable-component-update',
'--disable-default-apps',
'--disable-dev-shm-usage',
'--disable-domain-reliability',
'--disable-extensions',
'--disable-features=AudioServiceOutOfProcess',
'--disable-hang-monitor',
'--disable-ipc-flooding-protection',
'--disable-notifications',
'--disable-offer-store-unmasked-wallet-cards',
'--disable-popup-blocking',
'--disable-print-preview',
'--disable-prompt-on-repost',
'--disable-renderer-backgrounding',
'--disable-setuid-sandbox',
'--disable-speech-api',
'--disable-software-rasterizer',
'--disable-sync',
'--hide-scrollbars',
'--ignore-gpu-blacklist',
'--metrics-recording-only',
'--mute-audio',
'--no-default-browser-check',
'--no-first-run',
'--no-pings',
'--no-sandbox',
'--no-zygote',
'--password-store=basic',
'--use-gl=swiftshader',
'--use-mock-keychain'
]
});
Has anyone experienced this issue with SSH sessions before? I’d appreciate any suggestions on how to resolve it.