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

WECHATY_PUPPET=mock failed, TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string #1673

Closed
suntong opened this issue Dec 22, 2018 · 4 comments

Comments

@suntong
Copy link
Contributor

suntong commented Dec 22, 2018

This is a follow up from,
wechaty/puppet-wechat#60
in which all the relevant environment/install/config/running info is given.

I.e., under a fresh installation, the mock puppet is not working either:

$ WECHATY_PUPPET=mock node starter-bot.js
12:26:38 INFO Wechaty <mock> start() v0.22.6 is starting...
12:26:38 INFO PuppetManager install(mock@latest) please wait ...
npm: + [email protected]
added 1 package from 2 contributors and audited 65 packages in 1.701s

npm: found 0 vulnerabilities


12:26:41 INFO PuppetManager install(mock@latest) done
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Function.resolve (internal/modules/cjs/helpers.js:29:5)
    at new mock (/path/to/wechaty-getting-started/node_modules/wechaty/node_modules/mock/index.js:15:29)
    at Function.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:4:58)
12:26:41 ERR Wechaty start() exception: The "request" argument must be of type string. Received type undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Function.resolve (internal/modules/cjs/helpers.js:29:5)
    at new mock (/path/to/wechaty-getting-started/node_modules/wechaty/node_modules/mock/index.js:15:29)
    at Function.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:4:58)

Full Output Logs

Show Logs
$ WECHATY_LOG=silly WECHATY_PUPPET=mock node starter-bot.js
12:31:43 SILL Config WECHATY_LOG set level to silly
12:31:43 INFO Config registering process.on("unhandledRejection") for development/debug
12:31:43 VERB Config constructor()
12:31:43 SILL Accessory #0<Wechaty> constructor()
12:31:43 VERB Wechaty contructor()
12:31:43 VERB StateSwitch constructor(name=Wechaty)
12:31:43 VERB StateSwitch constructor(name=WechatyReady)
12:31:43 VERB Wechaty on(scan, function) registered
12:31:43 VERB Wechaty onFunction(scan)
12:31:43 VERB Wechaty on(login, function) registered
12:31:43 VERB Wechaty onFunction(login)
12:31:43 VERB Wechaty on(logout, function) registered
12:31:43 VERB Wechaty onFunction(logout)
12:31:43 VERB Wechaty on(message, function) registered
12:31:43 VERB Wechaty onFunction(message)
12:31:43 SILL Wechaty version() form development environment is not availble: ENOENT: no such file or directory, stat '/path/to/wechaty-getting-started/node_modules/wechaty/dist/.git'
12:31:43 INFO Wechaty <mock> start() v0.22.6 is starting...
12:31:43 VERB Wechaty puppet: undefined
12:31:43 VERB Wechaty profile: undefined
12:31:43 VERB Wechaty id: cjpzqqlsv0000c6fu7syky21h
12:31:43 SILL StateSwitch <Wechaty> on() is false
12:31:43 SILL StateSwitch <WechatyReady> off() is true
12:31:43 VERB StateSwitch <WechatyReady> off(true) <- (true)
12:31:43 SILL StateSwitch <Wechaty> on() is false
12:31:43 VERB StateSwitch <Wechaty> on(pending) <- (false)
12:31:43 VERB MemoryCard constructor(undefined)
12:31:43 VERB MemoryCard getStorage() for storage type: N/A
12:31:43 VERB MemoryCard load() from storage: N/A
12:31:43 VERB MemoryCard load() no storage
12:31:43 VERB Wechaty initPuppet() 
12:31:43 VERB MemoryCard multiplex(puppet)
12:31:43 VERB MemoryCard static multiplex(MemoryCard<>, puppet)
12:31:43 VERB MemoryCard constructor({"multiplex":{"name":"puppet","parent":{"payload":{},"multiplexNameList":[]}}})
12:31:43 VERB PuppetManager resolve({wechaty: Wechaty#cjpzqqlsv0000c6fu7syky21h<>(), puppet: mock, puppetOptions: undefined})
12:31:43 VERB PuppetManager resolveName(mock)
12:31:43 VERB PuppetManager checkModule(mock)
12:31:43 SILL PuppetManager checkModule() mock installed version 0.1.1 NOT satisfied range undefined
12:31:43 INFO PuppetManager install(mock@latest) please wait ...
npm: + [email protected]
updated 1 package and audited 65 packages in 1.702s

npm: found 0 vulnerabilities


12:31:46 INFO PuppetManager install(mock@latest) done
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Function.resolve (internal/modules/cjs/helpers.js:29:5)
    at new mock (/path/to/wechaty-getting-started/node_modules/wechaty/node_modules/mock/index.js:15:29)
    at Function.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:4:58)
12:31:46 ERR Wechaty start() exception: The "request" argument must be of type string. Received type undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "request" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Function.resolve (internal/modules/cjs/helpers.js:29:5)
    at new mock (/path/to/wechaty-getting-started/node_modules/wechaty/node_modules/mock/index.js:15:29)
    at Function.<anonymous> (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:58:34)
    at Generator.next (<anonymous>)
    at fulfilled (/path/to/wechaty-getting-started/node_modules/wechaty/dist/src/puppet-manager.js:4:58)
@suntong
Copy link
Contributor Author

suntong commented Dec 23, 2018

WECHATY_PUPPET=mock is the old usage.

@suntong suntong closed this as completed Dec 23, 2018
@suntong
Copy link
Contributor Author

suntong commented Dec 23, 2018

Is it possible to do a sanity check on the valid WECHATY_PUPPET values, instead failing messily like this?

@suntong suntong reopened this Dec 23, 2018
@huan
Copy link
Member

huan commented Dec 23, 2018

Could you try the @next version for this?

I remember that I had added this check for the latest code.

@suntong
Copy link
Contributor Author

suntong commented Dec 23, 2018

Oh, as long as you've checked it. I'm good -- as I want to keep at the stable side, and no more troubles as I had been through. thanks for fixing it.

@suntong suntong closed this as completed Dec 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants