herecy
herecy

Reputation: 55

How can I catch Puppeteer error Missing frame isMainFrame=false?

To simulate an error I rarely get but cannot reproduce in Puppeteer ^17.1.3, I inserted a throw at the exact same place:

PS C:\Users\User\Documents\project> node testingScript.js
C:\Users\User\Documents\project\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:124
        throw new Error("Missing frame isMainFrame=false, frameId=3427AF206D1A9A044F89F086F2CB9AB6")
              ^

Error: Missing frame isMainFrame=false, frameId=3427AF206D1A9A044F89F086F2CB9AB6
    at Connection.onMessage (C:\Users\User\Documents\project\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:124:15)
    at WebSocket.<anonymous> (C:\Users\User\Documents\project\node_modules\puppeteer\lib\cjs\puppeteer\node\NodeWebSocketTransport.js:45:32)
    at WebSocket.onMessage (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\event-target.js:199:18)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\websocket.js:1178:20)
    at Receiver.emit (node:events:390:28)
    at Receiver.dataMessage (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\receiver.js:528:14)
    at Receiver.getData (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\receiver.js:446:17)
    at Receiver.startLoop (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\receiver.js:148:22)
    at Receiver._write (C:\Users\User\Documents\project\node_modules\puppeteer\node_modules\ws\lib\receiver.js:83:10)

No matter what I try, I cannot seem to catch this error. How can I do that?

const puppeteer = require('puppeteer');

(async () => {
  try{
    browser = await puppeteer.launch().catch((err) => {
      console.log ("Error1: ", err)
    });
  } catch(e){
    console.log("Error2: "+e)
  }
})().catch((err) => {
  console.log ("Error3: ", err)
});;

Upvotes: 1

Views: 488

Answers (1)

herecy
herecy

Reputation: 55

Starting from puppeteer 18 the assertion is no longer there according to the developers, an update fixes the issue.

Upvotes: 1

Related Questions