[Bug] TypeError: utils.forOwn is not a function
See original GitHub issueHi, I’m running into this strange bug when using puppeteer-extra
, puppeteer-extra-plugin-stealth
with Typescript and the Serverless Framework. I will describe my setup and bug encountered below. I’ve tried a few things such as changing from puppeteer-core
to puppeteer
, but didn’t have any luck. I’m not sure if I missed anything obvious. Thanks for the help in advance!
The full error message is below. The error throws when calling puppeteerExtra.use(StealthPlugin());
. I tried other plugins such as puppeteer-extra-plugin-adblocker
and the error persists so I don’t think it’s the issue with a specific plugin.
✖ utils.forOwn is not a function
✖ TypeError: utils.forOwn is not a function
at cloneObjectDeep (/Users/leigong/git/friday/lambda/node_modules/merge-deep/node_modules/clone-deep/index.js:27:11)
at cloneDeep (/Users/leigong/git/friday/lambda/node_modules/merge-deep/node_modules/clone-deep/index.js:16:14)
at mergeDeep (/Users/leigong/git/friday/lambda/node_modules/merge-deep/index.js:19:16)
at new PuppeteerExtraPlugin (/Users/leigong/git/friday/lambda/node_modules/puppeteer-extra-plugin/src/index.ts:77:18)
at new StealthPlugin2 (/Users/leigong/git/friday/lambda/node_modules/puppeteer-extra-plugin-stealth/index.js:74:5)
at defaultExport (/Users/leigong/git/friday/lambda/node_modules/puppeteer-extra-plugin-stealth/index.js:172:31)
at Object.<anonymous> (/Users/leigong/git/friday/lambda/src/functions/hermes/handler.ts:13:20)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .js] (/Users/leigong/git/friday/lambda/node_modules/ts-node/src/index.ts:1587:43)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /Users/leigong/git/friday/lambda/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:166:133
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async InProcessRunner.run (/Users/leigong/git/friday/lambda/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js:166:9)
Here is a simplified version of the code snippet in .ts
import { Browser } from 'puppeteer';
import { addExtra } from 'puppeteer-extra';
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
import chromium from 'chrome-aws-lambda';
const puppeteerExtra = addExtra(chromium.puppeteer as any);
puppeteerExtra.use(StealthPlugin());
browser = await puppeteerExtra.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
ignoreHTTPSErrors: true,
})
const page = await browser.newPage();
// other scraping logics
The relevant version of the libraries are below
"puppeteer": "^10.1.0",
"puppeteer-extra": "^3.3.4",
"puppeteer-extra-plugin-adblocker": "^2.13.4",
"puppeteer-extra-plugin-stealth": "^2.11.0",
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
TypeError: puppeteer.launch is not a function #31796 - GitHub
I tried using the @types/pupetteer package and had problems. **TypeError: puppeteer.launch is not a function** at Object.
Read more >puppeteer.use(....) is not function error in Puppeteer - Nodejs
So I'm trying to run my code but it shows this error message:- (async ...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >How to Uncaught TypeError: x is not a function - YouTube
TypeError : "x" is not a functionThe JavaScript exception "is not a function " occurs when there was an attempt to call a...
Read more >CoffeeScript
The command-line version of coffee is available as a Node.js utility, requiring Node 6 or later. The core compiler however, does not depend...
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 FreeTop 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
Top GitHub Comments
I worked around this by overriding the version of “clone-deep” in my
package.json
I worked around this by overriding the version of “clone-deep” in my package.json when using yarn berry