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): Target closed.

See original GitHub issue

Description

It happens only if you’re using Proxies, after logging in, when the page redirects you. You get the error, I can’t share the website or the code 😦 When the error occurs, the page is still open, it’s not closed.

Full Error

Protocol error(Runtime.callFunctionOn): Target closed. (NetworkManager failed to process Fetch.requestPaused. Value cannot be null. Parameter name: key. at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at PuppeteerSharp.Helpers.MultiMap2.Add(TKey key, TValue value) at PuppeteerSharp.Helpers.AsyncDictionaryHelper2.<GetItemAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PuppeteerSharp.NetworkManager.<OnRequestAsync>d__46.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PuppeteerSharp.NetworkManager.<OnRequestPausedAsync>d__45.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at PuppeteerSharp.NetworkManager.<Client_MessageReceived>d__40.MoveNext())

Expected behavior:

Redirects just fine without the error occurring

Actual behavior:

That error occurs

Versions

Latest (2.0.3)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
kblokcommented, Jul 16, 2020

Fixed on #1521 thank you @kerohero! I hope this is the first PR of many to come!

1reaction
Kiro369commented, Jul 13, 2020

@kblok @Solaflex So I downloaded Puppeteer Sharp code and added it to my project to debug it The problem is in the NetworkManager file, the OnRequestAsync method, specifically in this line var frame = await FrameManager.TryGetFrameAsync(e.FrameId).ConfigureAwait(false); e.FrameId being null causes the exception, I gone to check Puppeteer itself and found this const frame = event.frameId ? this._frameManager.frame(event.frameId) : null; As you can see the frame itself can be null so I adjusted the code to be var frame = !string.IsNullOrEmpty(e.FrameId) ? await FrameManager.TryGetFrameAsync(e.FrameId).ConfigureAwait(false) : null; Works like a charm for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protocol error (Runtime.callFunctionOn): Target closed. ...
I'm running into this error after 22 intervals. Node.js 8 + Puppeteer on Debian. try { await page.evaluate(async () => ( new ...
Read more >
Protocol error (Runtime.callFunctionOn): Target closed. ...
I want to iterate over key-pairs of data.extractRules and get elements data from the page . This snippet inside forEach loop is causing...
Read more >
Error - Target closed
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 ...
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 >
Protocol error (Runtime.callFunctionOn): Target cl - NodeJS
NodeJS : UnhandledPromiseRejectionWarning: Error: Protocol error (Runtime.callFunctionOn): Target closed. (Puppeteer)To Access My Live Chat ...
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