Protocol error - Target closed: puppeteer stopped working.
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 10.1.0
- Platform / OS version: Arch Linux x86_64 5.13.6-arch1-1
- URLs (if applicable):
- Node.js version: v16.6.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
mkdir -p /tmp/test-p && cd /tmp/test-pyarn init(default for all options)yarn add puppeteervim ./index.jsthen copy/paste/save the first code example in the readme:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'example.png' });
await browser.close();
})();
node ./index.js
What is the expected result? No error and a screenshot.
What happens instead?
/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217
this._callbacks.set(id, { resolve, reject, error: new Error(), method });
^
Error: Protocol error (Page.navigate): Target closed.
at /tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217:63
at new Promise (<anonymous>)
at CDPSession.send (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:216:16)
at navigate (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:108:47)
at FrameManager.navigateFrame (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:91:13)
at Frame.goto (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:416:41)
at Page.goto (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1133:53)
at /tmp/test-p/index.js:6:14
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Additional information I’ve been using puppeteer for months without any issue. Earlier, I tried to run one of my scripts but I got the error above. I tried to narrow the problem and found out that it still happens even with a fresh install and a simple code.
Whats the root cause of this error ? Am i doing something wrong ? Needless to say that i didn’t find any answer in google/SO/etc.
Thanks in advance!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Puppeteer - Protocol error (Page.navigate): Target closed
The Target closed exception is thrown when you are trying to run a function, but the target (tab) was already closed. Similar error...
Read more >Error - Target closed
Obvious possible cause: the browser, context or tab is being closed at the wrong time in the script. Not-so-obvious possible cause: promises are...
Read more >puppeteer-chat/Lobby
{ Error: Protocol error (Runtime.callFunctionOn): Target closed. at Promise (/src/app/node_modules/puppeteer/lib/Connection.js:183:56)
Read more >How to use Puppeteer inside a Docker container
and i get this error "Protocol error (Target. ... https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n". 1 like Like
Read more >Puppeteer - Protocol error (Page.navigate): Target closed
Puppeteer - Protocol error (Page.navigate): Target closed. Answer a question As you can see with the sample code below, I'm using Puppeteer ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m using puppeteer@13.0.1 with no problems now.
Exact same issue here with Puppeteer v10.2.0, v9.1.1, v8.0.0 & Node v16.9.1, v14.17.4. Downgrading to Puppeteer v7.1.0 resolves the issue, so it’s something introduced between v7.1.0 and v8.0.0.
Technically, it’s not a
Page.goto()issue,ChromeLauncher.launch()will also fail on its own half a second later:All Chromium dependencies installed, using Brave as a daily browser without issues.