Puppeteer-extra: StealthPlugin (puppeteer v3.2.0): TypeError: browser.setMaxListeners is not a function

Created on 29 May 2020  路  11Comments  路  Source: berstend/puppeteer-extra

StealthPlugin fails with TypeError after upgrade to puppeteer v3.2.0.

TypeError: browser.setMaxListeners is not a function
    at StealthPlugin.onBrowser (.../node_modules/puppeteer-extra-plugin-stealth/index.js:155:13)
    at StealthPlugin._bindBrowserEvents (.../node_modules/puppeteer-extra-plugin/dist/index.cjs.js:479:24)

Note, according to release notes, puppeteer v3.2.0 switched to Mitt instead of EventEmitter.

Most helpful comment

Workaround:

const puppeteer = require('puppeteer-extra');
const stealth = require('puppeteer-extra-plugin-stealth')();

stealth.onBrowser = () => {};
puppeteer.use(stealth);

All 11 comments

Node v10x... succesfull but i upgrade my nodejs for latest version v12x.. and then i have got fail.

My package.json dependencies config
"puppeteer": "^3.1.0",
"puppeteer-extra": "^3.1.9",

Workaround:

const puppeteer = require('puppeteer-extra');
const stealth = require('puppeteer-extra-plugin-stealth')();

stealth.onBrowser = () => {};
puppeteer.use(stealth);

No, dont do that. Just try uninstall puppeteer and then
npm install [email protected]

its work for me

@bacaist yep, I know you can pin the last good known version.

However, if you want to be up to date with upstream dependency (which is updated often), you can apply above workaround (consider to have a look at source code of Mitt and StealthPlugin to better understand the change).

@akornatskyy any idea how to implement that fix in typescript? That doesn't seem to work for me as shown in your solution.

@GitRubb consider upgrade to version v3.3.0, read more here, please.

reappear with puppeteer version 4.0.0

the above workaround is confirmed to work with v4.0.0.

Still same with 4.4.0 too

Still same with 4.4.0 too

@kkmuffme did you try the above workaround?

Ah thank you, I somehow missed that & just tried reinstalling

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JustinELRoberts picture JustinELRoberts  路  5Comments

methyl picture methyl  路  8Comments

engineswap picture engineswap  路  7Comments

hgenchev99 picture hgenchev99  路  6Comments

Sesamestrong picture Sesamestrong  路  7Comments