puppeteer: [Bug]: Protocol error (Target.setAutoAttach): Target closed
Bug expectation
Recently updated puppeteer.js to v20+ (all versions have the same issue)
And from time to time I get
I run Puppeteer in Docker Alpine image
node - v19.7.0 puppeteer@20.1.2 Chromium 112.0.5615.165
ProtocolError: Protocol error (Target.setAutoAttach): Target closed
--
at new Callback (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:61:35)
at CallbackRegistry.create (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:106:26)
at Connection._rawSend (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:216:26)
at Connection.send (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:210:21)
at ChromeTargetManager.initialize (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ChromeTargetManager.js:242:82)
at CDPBrowser._attach (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:157:76)
at CDPBrowser._create (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:50:23)
We mainly use puppeteer for pdf generation and this issue causes a lot of headaches…
Restarting it sometimes works sometimes does not… Have no idea how to solve it as it seems random and has no pattern.
I tried many solutions suggested with “Target closed”, does not seem to take any effect.
Any workaround or hack is helpful.
Bug behavior
- Flaky
Minimal, reproducible example
N/A
Error string
ProtocolError: Protocol error (Target.setAutoAttach): Target closed
Puppeteer configuration
'--headless',
'--disable-web-security',
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process',
'--disable-gpu',
usePipe: true,
disableJavascript: true,
waitUntil: ["networkidle2", "domcontentloaded", "load"]
Puppeteer version
20.1.2
Node version
v19.7.0
Package manager
npm
Package manager version
9.1.2
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20
Indeed it was an issue with
Dbus
my root directory was read-only this caused issues with dbus not being able to make a socket… Still weird why it sometimes worked…P.S. chatgpt helped with this one 😄
Hi,
I used kubernetes, so the fix was