When would an error "Cannot find context with specified id undefined" happen?
See original GitHub issueI am getting the following error:
Error: Protocol error (Runtime.callFunctionOn): Cannot find context with specified id undefined
at Session._onMessage (/srv/node_modules/puppeteer-edge/lib/Connection.js:205:25)
at Connection._onMessage (/srv/node_modules/puppeteer-edge/lib/Connection.js:105:19)
at emitOne (events.js:115:13)
at WebSocket.emit (events.js:210:7)
at Receiver._receiver.onmessage (/srv/node_modules/ws/lib/WebSocket.js:143:47)
at Receiver.dataMessage (/srv/node_modules/ws/lib/Receiver.js:389:14)
at Receiver.getData (/srv/node_modules/ws/lib/Receiver.js:330:12)
at Receiver.startLoop (/srv/node_modules/ws/lib/Receiver.js:165:16)
at Receiver.add (/srv/node_modules/ws/lib/Receiver.js:139:10)
at Socket._ultron.on (/srv/node_modules/ws/lib/WebSocket.js:139:22)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at Socket.Readable.push (_stream_readable.js:211:10)
at TCP.onread (net.js:585:20)
It is a large codebase and it is unclear whats triggering this error.
Any guides?
On that note, there needs to be a better way to throw error. Without knowing the origin of the error in the code it is impossible to trace down these exceptions.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:132
- Comments:103 (29 by maintainers)
Top Results From Across the Web
cannot find context with specified id undefined - Stack Overflow
My test was completing but I was getting this error when attempting to await browser.close(); Adding the wait after searching for my final ......
Read more >puppeteer error "Cannot find context with specified id undefined"
What are you trying to achieve? open a page; click a link by click; see text from new page. What do you get...
Read more >Testbot failures "Cannot find context with specified id" - Drupal
It seems some of the random failures happen when the chromedriver can't find a stale context. Therefore, I'm removing this: - $session =...
Read more >undefined - JavaScript - MDN Web Docs - Mozilla
The global undefined property represents the primitive value undefined . It is one of JavaScript's primitive types.
Read more >Cannot read properties of undefined (reading 'length') - TrackJS
This is a blocking error, and script execution will stop when this error occurs. Understanding the Root Cause. This error can be thrown...
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
Hi, encountered this problem when updating code that was using puppeteer < 1.0 to newest version. I was also able to find source of the problem.
First, my reproduction script
with error:
Please note that it doesn’t happen every time so I added the loop, but possibly 10 runs may be not enough.
End the source of the problem is that line: https://github.com/GoogleChrome/puppeteer/blob/808bf8e5582482a1d849ff22a51e52024810905c/lib/FrameManager.js#L875 You can replace evaluation with
If you look at
rerun
function as a whole you will see that earlier it is wrapping evaluation in try/catch and handles errors but that evaluation is not protected in any way. Ironically later there is check forCannot find context with specified id
but it is never reached if second evaluation fails./cc @JoelEinbinder @aslushnikov author and reviewer of #1746 that introduced the problematic line
Then why not release
0.14.0
? Like, now.There is literally no reason whatsoever not to automate the releases. There is no reason whatsoever not to release a new version every time a PR has been merged into the master. If you merge something into the master, then it is ready for the release.