Puppeteer-extra: Puppeteer Extra Stealth is not a function

Created on 24 Feb 2020  路  4Comments  路  Source: berstend/puppeteer-extra

Hi, I get the following error:
UnhandledPromiseRejectionWarning: TypeError: puppeteer_extra_plugin_stealth_1.default is not a function

When using the following code to initialize puppeteer-extra:
this.browser = await puppeteer.use(StealthPlugin()).launch(this.settings.puppeteerSettings);

and using these imports:
import puppeteer from 'puppeteer-extra'; import StealthPlugin from 'puppeteer-extra-plugin-stealth';

bug more-info-needed

Most helpful comment

This is most likely related to your local tsconfig.json (specifically: allowSyntheticDefaultImports).

See here for more info: https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage

Confirmed, allowSyntheticDefaultImports + esModuleInterop has to be specified and set to true

All 4 comments

Does this still happen?

If yes, what version are you using and if bumping the dependencies to their latest version help?

Having a simpler way to reproduce the problem would be nice since i don't know what this.settings.puppeteerSettings holds.

I had the same issue with the latest version. Looks like problem with TypeScript typings definition. My workaround was to change:

import StealthPlugin from 'puppeteer-extra-plugin-stealth';

into

const StealthPlugin = require("puppeteer-extra-plugin-stealth");

This is most likely related to your local tsconfig.json (specifically: allowSyntheticDefaultImports).

See here for more info: https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage

This is most likely related to your local tsconfig.json (specifically: allowSyntheticDefaultImports).

See here for more info: https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage

Confirmed, allowSyntheticDefaultImports + esModuleInterop has to be specified and set to true

Was this page helpful?
0 / 5 - 0 ratings