question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Protocol error (Runtime.callFunctionOn) on remote debugger

See original GitHub issue

Issue I’m having this strange exception, which seems to happen randomly, shortly after making the connection.

Exception “Protocol error (Runtime.callFunctionOn): Session closed. Most likely the Page has been closed.Close reason: The remote party closed the WebSocket connection without completing the close handshake.”

Stacktrace " at PuppeteerSharp.CDPSession.SendAsync(String method, Object args, Boolean waitForCallback) at PuppeteerSharp.CDPSession.SendAsync[T](String method, Object args) at PuppeteerSharp.ExecutionContext.ExecuteEvaluationAsync(String method, Object args) at PuppeteerSharp.ExecutionContext.EvaluateFunctionHandleAsync(String script, Object[] args) at PuppeteerSharp.ElementHandle.XPathAsync(String expression) at PuppeteerSharp.DOMWorld.XPathAsync(String expression)"

This doesn’t happen when i launch the chrome instance within the code itself through Puppeteer.LaunchAsync. This happens only when using a remote chrome debugger like browserless.io in docker.

Reproduction:

  1. Start browserless docker container docker run -e “DEFAULT_HEADLESS=false” -p 3000:3000 --restart always -d --name browserless browserless/chrome:1.40-chrome-stable

  2. Connect with PuppeteerSharp

var browser = await Puppeteer.ConnectAsync(new ConnectOptions() { BrowserWSEndpoint = "ws://localhost:3000" }); var page = await browser.NewPageAsync();

  1. Navigate to some arbitrary page and loop random actions like await page.XPathAsync() await (elementHandle).ClickAsync() etc.

In my case, the exception seems to be thrown by either of the actions listed above.

Any suggestions or possible fixes would be greatly appreciated Thanks for building this amazing port!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
victornorcommented, Oct 22, 2020

Apparently browserless kills sessions automatically after 30 seconds. The argument is called “connection timeout”, so i didn’t think this was the issue.

Thanks for your time.

0reactions
victornorcommented, Oct 22, 2020

I don’t get any logs on the docker container. But i’m using browserless docker image, so there might be some argument to enable logging. Will look more into that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer - Protocol error (Page.navigate): Target closed
Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed. I read at some git issue (that I can't ...
Read more >
Runtime.callFunctionOn arguments
When I try to call a function on a remote object, I get an error message about invalid parameters. After Page.documentUpdated after Page....
Read more >
Protocol error (Runtime.callFunctionOn): Object is not ...
This is from Puppeteer unit tests like 'window.open should use parent tab context' in browsercontext.spec.js. Overall I can see it 16 times in...
Read more >
1650112 - Runtime.callFunctionOn and ...
The failure as reported is: Error: Evaluation failed: call to Function() blocked by CSP at ExecutionContext._evaluateInternal (/Users/henrik/code/gecko/remote/ ...
Read more >
Runtime domain - Chrome DevTools Protocol
Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found