UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Target closed
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 3.2.0
- Platform / OS version: Windows 10
- URLs (if applicable):
- Node.js version: v14.2.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- node init
- npm install pupperteer
- create a index.json with
(async () => {
const browser = await puppeteer.connect(
{
browserWSEndpoint: 'ws://browserless.azurewebsites.net',
}
);
const page = await browser.newPage()
var html;
html = fs.readFileSync('content.txt', 'utf8');
console.log(html);
await page.setContent(html, { waitUntil:'networkidle2' });
await page.pdf({path: 'content.pdf', format: 'A4'});
await browser.close();
})();
- Content i try to set content.txt
What is the expected result? I aspect not give error. The problem it is my Azure Linux Docket. In particular i use https://github.com/browserless/chrome. For smal set content work well big content like example not work why? I can also add that content work well on my local docker emulator. So i think there is somethin in Azure machine. But support don’t know why. Any edeal?
What happens instead? Exception:
(node:28820) UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Target closed.
at E:\Angular\NodejsTest\node_modules\puppeteer\lib\Connection.js:152:63
at new Promise (<anonymous>)
at CDPSession.send (E:\Angular\NodejsTest\node_modules\puppeteer\lib\Connection.js:151:16)
at ExecutionContext._evaluateInternal (E:\Angular\NodejsTest\node_modules\puppeteer\lib\ExecutionContext.js:85:50)
at ExecutionContext.evaluate (E:\Angular\NodejsTest\node_modules\puppeteer\lib\ExecutionContext.js:33:27)
at ExecutionContext.<anonymous> (E:\Angular\NodejsTest\node_modules\puppeteer\lib\helper.js:95:27)
at DOMWorld.evaluate (E:\Angular\NodejsTest\node_modules\puppeteer\lib\DOMWorld.js:89:24)
at async DOMWorld.setContent (E:\Angular\NodejsTest\node_modules\puppeteer\lib\DOMWorld.js:146:9)
-- ASYNC --
at Frame.<anonymous> (E:\Angular\NodejsTest\node_modules\puppeteer\lib\helper.js:94:19)
at Page.setContent (E:\Angular\NodejsTest\node_modules\puppeteer\lib\Page.js:473:46)
at Page.<anonymous> (E:\Angular\NodejsTest\node_modules\puppeteer\lib\helper.js:95:27)
at E:\Angular\NodejsTest\index.js:24:14
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which
was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The logs for a failed request from the default docker log is given below:
2020-06-04T22:53:03.592844045Z 2020-06-04T22:53:03.592Z browserless:chrome-helper Launching Chrome with args: {
2020-06-04T22:53:03.592862946Z "args": [
2020-06-04T22:53:03.592869946Z "--no-sandbox",
2020-06-04T22:53:03.592875546Z "--enable-logging",
2020-06-04T22:53:03.592894247Z "--v1=1",
2020-06-04T22:53:03.592900247Z "--remote-debugging-port=43044",
2020-06-04T22:53:03.592905847Z "--user-data-dir=/tmp/browserless-data-dir-YgH6fO",
2020-06-04T22:53:03.592911548Z "--remote-debugging-pipe"
2020-06-04T22:53:03.592917048Z ],
2020-06-04T22:53:03.592922248Z "blockAds": false,
2020-06-04T22:53:03.592927448Z "headless": true,
2020-06-04T22:53:03.592933148Z "ignoreDefaultArgs": false,
2020-06-04T22:53:03.592938348Z "ignoreHTTPSErrors": false,
2020-06-04T22:53:03.592943449Z "pauseOnConnect": false,
2020-06-04T22:53:03.592948749Z "executablePath": "/usr/bin/google-chrome",
2020-06-04T22:53:03.592954149Z "handleSIGINT": false,
2020-06-04T22:53:03.592959349Z "handleSIGTERM": false
2020-06-04T22:53:03.592959349Z "handleSIGTERM": false
2020-06-04T22:53:03.592999350Z }
2020-06-04T22:53:03.827410349Z 2020-06-04T22:53:03.826Z browserless:chrome-helper Chrome PID: 1205
2020-06-04T22:53:03.878986021Z 2020-06-04T22:53:03.878Z browserless:system Chrome launched 287ms
2020-06-04T22:53:03.879868850Z 2020-06-04T22:53:03.879Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Starting sessio
n.
2020-06-04T22:53:03.880129858Z 2020-06-04T22:53:03.880Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Proxying reques
t to /devtools/browser route: ws://localhost:43044/devtools/browser/529bd18d-e01b-444b-84c6-908300cd8146.
2020-06-04T22:53:06.859383538Z 2020-06-04T22:53:06.859Z browserless:server Issue communicating with Chrome: "write ECONNR
ESET"
2020-06-04T22:56:03.592340095Z 2020-06-04T22:56:03.591Z browserless:server ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Recording ti
medout stat.
2020-06-04T22:56:03.592573403Z 2020-06-04T22:56:03.592Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Job has timed-o
ut, closing the WebSocket.
2020-06-04T22:56:03.592764509Z 2020-06-04T22:56:03.592Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Cleaning up job
2020-06-04T22:56:03.592800810Z 2020-06-04T22:56:03.592Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Browser not nee
ded, closing
2020-06-04T22:56:03.592814410Z 2020-06-04T22:56:03.592Z browserless:chrome-helper Shutting down browser with close comman
d
2020-06-04T22:56:03.592819911Z 2020-06-04T22:56:03.592Z browserless:chrome-helper Removing temp data-dir /tmp/browserless
-data-dir-YgH6fO
2020-06-04T22:56:03.594237857Z 2020-06-04T22:56:03.594Z browserless:chrome-helper Sending SIGKILL signal to browser proce
ss 1205
2020-06-04T22:56:03.616409176Z 2020-06-04T22:56:03.616Z browserless:server Current workload complete.
2020-06-04T22:56:03.617364307Z 2020-06-04T22:56:03.616Z browserless:job ZWV10NPLC1U4DPKLV0R43WJHFOMM1YK2: Browser cleanup
complete.
2020-06-04T22:56:03.646864863Z 2020-06-04T22:56:03.646Z browserless:chrome-helper Browser process exited with code 0 and
signal null, cleaning up
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Protocol error (Runtime.callFunctionOn): Target closed. · Issue ...
I'm running into this error after 22 intervals. Node.js 8 + Puppeteer on Debian. try { await page.evaluate(async () => ( new ...
Read more >UnhandledPromiseRejectionWar...
(node:27876) UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Target closed. at Promise (C:\Users\Mihir\fae\ ...
Read more >puppeteer-chat/Lobby - Gitter
For some reason the page opens but doesn't execute the code within. ... { Error: Protocol error (Runtime.callFunctionOn): Target closed.
Read more >Error - Target closed - Checkly
Example error message: UnhandledPromiseRejectionWarning: Error: Protocol error: Target closed Possible causes Obvious possible cause: the browser, ...
Read more >Protocol error (Runtime.callFunctionOn): Object is not ...
Protocol error (Runtime.callFunctionOn): Object is not serializable _serialize@chrome://remote/content/domains/content/runtime/ExecutionContext.jsm:265:13 ...
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

@joelgriffith what to you mean by One possible solution is to call browser.close and see if it goes away, can you elaborate how to do it. we are getting same error just a page.goto url and await fse.outputFile(tmpDir + flyerDir + tmpInputFile, await page.content()) don’t know what is the issue here, it happens rarely and it is coming in aws-lambda for multiple requests.
Same error. I have a project run perfect on v5.4.1, I update to v5.5.0 and this happen.