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.

executionContextId is 0 when using multiples connections

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: Master branch
  • Platform / OS version: MacOS 10.14.2
  • Node.js version: v8.10

What steps will reproduce the problem?

(async() => {
    var options =  { headless : true, };
    var browser = await puppeteer.launch(options);
    var browserWSEndpoint = browser.wsEndpoint();

    var browser2 = await puppeteer.connect({ browserWSEndpoint });
    var page = (await browser2.pages())[0];
    await page.evaluateOnNewDocument(() => {console.log('Loading js helper1');});
    await page.goto("https://www.google.com");
    browser2.disconnect();

    var browser3 = await puppeteer.connect({ browserWSEndpoint });
    var page2 = (await browser3.pages())[0];
    await page2.goto("https://www.google.com");
    await page2.evaluateOnNewDocument(() => {console.log('Loading js helper1');});

    browser3.disconnect();
    browser.close();
})();

What is the expected result? It shouldn’t fail.

What happens instead? I’m getting a

(node:28860) UnhandledPromiseRejectionWarning: Error: INTERNAL ERROR: missing context with id = 0
warning.js:18
    at assert (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/helper.js:278:11)
    at FrameManager.executionContextById (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/FrameManager.js:308:5)
    at Page._onConsoleAPI (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:504:40)
    at CDPSession.Page.client.on.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:133:57)
    at emitOne (events.js:116:13)
    at CDPSession.emit (events.js:211:7)
    at CDPSession._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:216:12)
    at Connection._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:99:19)
    at WebSocketTransport._ws.addEventListener.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/WebSocketTransport.js:41:24)
    at WebSocket.onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/node_modules/ws/lib/event-target.js:120:16)
(node:28860) 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(). (rejection id: 1)
warning.js:18
```

This was reported on Puppeteer-Sharp https://github.com/kblok/puppeteer-sharp/issues/856

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Jan 29, 2019

@kblok yep manager to reproduce it!

1reaction
kblokcommented, Jan 29, 2019

@aslushnikov could you try that script with https://www.facebook.com?

Darios-MBP:puppeteer neo$ node test/playground.js
Iteration #0
Iteration #1
(node:34022) UnhandledPromiseRejectionWarning: Error: INTERNAL ERROR: missing context with id = 0
    at assert (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/helper.js:229:11)
    at FrameManager.executionContextById (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/FrameManager.js:333:5)
    at Page._onConsoleAPI (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:520:40)
    at CDPSession.Page.client.on.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:135:57)
    at emitOne (events.js:116:13)
    at CDPSession.emit (events.js:211:7)
    at CDPSession._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:200:12)
    at Connection._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:112:17)
    at WebSocketTransport._ws.addEventListener.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/WebSocketTransport.js:41:24)
    at WebSocket.onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/node_modules/ws/lib/event-target.js:120:16)
(node:34022) 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 handledwith .catch(). (rejection id: 1)
(node:34022) [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.
Iteration #2
(node:34022) UnhandledPromiseRejectionWarning: Error: INTERNAL ERROR: missing context with id = 0
    at assert (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/helper.js:229:11)
    at FrameManager.executionContextById (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/FrameManager.js:333:5)
    at Page._onConsoleAPI (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:520:40)
    at CDPSession.Page.client.on.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:135:57)
    at emitOne (events.js:116:13)
    at CDPSession.emit (events.js:211:7)
    at CDPSession._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:200:12)
    at Connection._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:112:17)
    at WebSocketTransport._ws.addEventListener.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/WebSocketTransport.js:41:24)
    at WebSocket.onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/node_modules/ws/lib/event-target.js:120:16)
(node:34022) 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 handledwith .catch(). (rejection id: 2)
Iteration #3
(node:34022) UnhandledPromiseRejectionWarning: Error: INTERNAL ERROR: missing context with id = 0
    at assert (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/helper.js:229:11)
    at FrameManager.executionContextById (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/FrameManager.js:333:5)
    at Page._onConsoleAPI (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:520:40)
    at CDPSession.Page.client.on.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Page.js:135:57)
    at emitOne (events.js:116:13)
    at CDPSession.emit (events.js:211:7)
    at CDPSession._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:200:12)
    at Connection._onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/Connection.js:112:17)
    at WebSocketTransport._ws.addEventListener.event (/Users/neo/Documents/Coding/Open Source/puppeteer/lib/WebSocketTransport.js:41:24)
    at WebSocket.onMessage (/Users/neo/Documents/Coding/Open Source/puppeteer/node_modules/ws/lib/event-target.js:120:16)
(node:34022) 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 handledwith .catch(). (rejection id: 3)
Iteration #4
Read more comments on GitHub >

github_iconTop Results From Across the Web

Play Framework 2.1 - Cannot find an implicit ExecutionContext
According to this issue, it is fixed in the documentation. I needed to add the following import: import play.api.libs.concurrent.Execution.Implicits._.
Read more >
7 Advanced Language Features
You are required to use a different execution context instance for each thread. You can accomplish this in one of two ways: Specify...
Read more >
Microsoft.Data.SqlClient.SqlException (0x80131904)
I am seeing the following exception occur sporadically in my logs: Microsoft.Data.SqlClient.SqlException (0x80131904): Connection Timeout ...
Read more >
Execution context | NestJS - A progressive Node.js framework
Execution context. Nest provides several utility classes that help make it easy to write applications that function across multiple application contexts ...
Read more >
J2CA - IBM
Collect diagnostic data and visit the IBM support site for more information. ... J2CA0045E: Connection not available while invoking method {0} for resource ......
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