Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] TypeError: Cannot read property 'name' of undefined #574

Closed
alamothe opened this issue Oct 9, 2021 · 4 comments
Closed

[Bug] TypeError: Cannot read property 'name' of undefined #574

alamothe opened this issue Oct 9, 2021 · 4 comments
Labels
issue: bug report A bug has been reported wontfix This will not be worked on

Comments

@alamothe
Copy link

alamothe commented Oct 9, 2021

Describe the bug

After upgrading puppeteer-extra-plugin-stealth from 2.6.7 to a new version, and installing puppeteer-extra-plugin-user-data-dir, I get the following when I try to run it:

/Users/alamothe/Projects/car-manager/login-service/node_modules/universalify/index.js:15
  }, 'name', { value: fn.name })
                         ^
TypeError: Cannot read property 'name' of undefined
    at exports.fromCallback (/Users/alamothe/Projects/car-manager/login-service/node_modules/universalify/index.js:15:26)
    at Object.<anonymous> (/Users/alamothe/Projects/car-manager/login-service/node_modules/fs-extra/lib/fs/index.js:57:27)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/alamothe/Projects/car-manager/login-service/node_modules/fs-extra/lib/index.js:5:6)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

This happens on both MacOS and Windows machine.

Versions

  System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 3.98 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.1 - /usr/local/opt/node@14/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/opt/node@14/bin/npm
  npmPackages:
    puppeteer: 10.4.0 => 10.4.0 
    puppeteer-extra: 3.2.3 => 3.2.3 
    puppeteer-extra-plugin-recaptcha: 3.5.0 => 3.5.0 
    puppeteer-extra-plugin-stealth: 2.7.10 => 2.7.10 
    puppeteer-extra-plugin-user-data-dir: ^2.3.1 => 2.3.1 
@alamothe alamothe added issue: bug report A bug has been reported needs triage labels Oct 9, 2021
@berstend
Copy link
Owner

berstend commented Oct 10, 2021

Is it possible one of the dependencies used by extra conflicts with a version your project depends on as well? 🤔

It'd be interesting to see if a fresh project folder with the same versions and just the example code from the readme would yield this issue as well.

Alternatively the output of these commands would be interesting (specifically the package version numbers):

yarn why universalify
yarn why fs-extra

For reference:

=> Found "puppeteer-extra-plugin-user-data-dir#fs-extra@10.0.0"
info This module exists because "_project_#puppeteer-extra-plugin-user-data-dir" depends on it.

=> Found "puppeteer-extra-plugin-user-data-dir#universalify@2.0.0"
info Reasons this module exists
   - "_project_#puppeteer-extra-plugin-user-data-dir#fs-extra" depends on it
   - Hoisted from "_project_#puppeteer-extra-plugin-user-data-dir#fs-extra#universalify"
   - Hoisted from "_project_#puppeteer-extra-plugin-user-data-dir#fs-extra#jsonfile#universalify"

@berstend berstend added the more-info-needed Further information is requested label Oct 10, 2021
@alamothe
Copy link
Author

This is the output:

$ yarn why universalify
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "universalify"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "universalify@0.1.2"
info Reasons this module exists
   - "patch-package#fs-extra" depends on it
   - Hoisted from "patch-package#fs-extra#universalify"
info Disk size without dependencies: "16KB"
info Disk size with unique dependencies: "16KB"
info Disk size with transitive dependencies: "16KB"
info Number of shared dependencies: 0
✨  Done in 0.29s.

$ yarn why fs-extra
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "fs-extra"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "fs-extra@7.0.1"
info Reasons this module exists
   - "patch-package" depends on it
   - Hoisted from "patch-package#fs-extra"
info Disk size without dependencies: "264KB"
info Disk size with unique dependencies: "356KB"
info Disk size with transitive dependencies: "356KB"
info Number of shared dependencies: 3
✨  Done in 0.28s.

This is before the upgrade. It's weird it's causing the problems since patch-package is a dev dependency. I could try to upgrade then remove patch-package although my project heavily depends on it.

@berstend
Copy link
Owner

Yeah, the joy of node dependencies. 😄 patch-package is using outdated dependencies which apparently is causing issues as the stealth/user-data-dir plugin expect more recent versions.

Your options:

  • try to update patch-package or create a fork with a more recent fs-extra version
  • there's ways to "pin" hoisted dependency versions in yarn
  • disable the user-agent-override evasion in stealth (the only one requiring the user-data-dir plugin)

Good luck! closing this as "WONTFIX" for now.

@berstend berstend added wontfix This will not be worked on and removed more-info-needed Further information is requested needs triage labels Oct 13, 2021
@lamweili
Copy link

Related to fs.realpath.native being undefined, causing import of fs-extra@10.0.0 to throw error.

Defensively patched in jprichardson/node-fs-extra#953 and released in fs-extra@10.1.0.

But still, why is fs.realpath.native undefined? That is a root cause to be investigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug report A bug has been reported wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants