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

TypeError: Cannot read property 'type' of undefined at AnotherOriginalClass.type #1545

Closed
TbhT opened this issue Aug 14, 2018 · 7 comments
Closed
Labels

Comments

@TbhT
Copy link
Contributor

TbhT commented Aug 14, 2018

TypeError: Cannot read property 'type' of undefined at AnotherOriginalClass.type (*******\node_modules\_wechaty@0.18.5@wechaty\dist\src\user\contact.js:381:29)

the example from-here .

when i use contact.type(), it happens. so i have to use personal() or official() instead.

@huan
Copy link
Member

huan commented Aug 14, 2018

Because you did neither provide any version information and detailed log messages, nor any reproduce steps, so I'm afraid that I can not be able to find the reason for this TypeError.

However, if you can use personal() and official() without the problem, please use them as a wrokaround.

If you still want to use contact.type(), please clone the getting-started project from https://github.com/Chatie/wechaty-getting-started and use it to provide the reproduce steps with the detailed log messages.

Have a nice day.

@TbhT
Copy link
Contributor Author

TbhT commented Aug 14, 2018

my wechaty version is 0.18.5, but the wechaty-getting-started version is 0.19.153.

i just clone and cnpm install & cnpm start this project , it run well before i run node examples/basic/contact-bot.js.

: ( , the error stack as follows :

>>>>>>>>>>>>>>>>>>> Error: no payload at AnotherOriginalClass.type (D:\wechaty-getting-started\node_modules\_wechaty@0.19.153@wechaty\dist\src\user\contact.js:448:19) at main (D:\wechaty-getting-started\examples\basic\contact-bot.js:65:17) at process._tickCallback (internal/process/next_tick.js:68:7)

well , i use the cnpm to run this project , maybe it has no influence for the project .

the error is stil.

//  i change some code for the error stack
// contact-bot.js

async function onLogin (user) {
  console.log(`${user} login`)
  try {
    await main()
  } catch (e) {
    console.log('>>>>>>>>>>>>>>>>>>>', e)
  }
}

@huan huan added the bug label Aug 14, 2018
@huan
Copy link
Member

huan commented Aug 14, 2018

Confirmed this is a bug related with Contact.findAll() and Room.findAll(), they did not prepare the data in a proper manner.

@TbhT
Copy link
Contributor Author

TbhT commented Aug 14, 2018

does it occurs all versions or 0.18 or higher?

huan added a commit to wechaty/getting-started that referenced this issue Aug 14, 2018
@huan
Copy link
Member

huan commented Aug 14, 2018

I'm not sure when this bug had been introduced in, but it should be fixed after v0.19.154.

Please try again by check out the latest code from the wechaty-getting-started repo.

@TbhT
Copy link
Contributor Author

TbhT commented Aug 14, 2018

well , when i run the node examples\advanced\room-bot.js , the global event room-join, room-leave, room-topic, errors happens.

it is in the project https://github.com/Chatie/wechaty-getting-started.

17:28:32 ERR PuppetPuppeteer roomRawPayload(********) 
exception: no payload
(node:10140) UnhandledPromiseRejectionWarning: Error: no payload
    at PuppetPuppeteer.<anonymous> (D:\wechaty-getting-started\node_modules\_wechaty@0.19.154@wechaty\node_modules\wechaty-puppet-puppeteer\dist\src\puppet-puppeteer.js:601:23)
    at Generator.next (<anonymous>)
    at fulfilled (D:\wechaty-getting-started\node_modules\_wechaty@0.19.154@wechaty\node_modules\wechaty-puppet-puppeteer\dist\src\puppet-puppeteer.js:22:58)
(node:10140) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated  either by throwing inside of an async function without a catch block, or by rejecting a promise which was  not handled with .catch(). (rejection id: 1)
(node:10140) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the  future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit  code.

do i need reopen a issue for the problem above?

@huan
Copy link
Member

huan commented Aug 14, 2018

Yes, please open an new issue and follow the template because it's a different problem.

And also please close this issue if your problem was solved.

Thanks you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants