Please search in FAQ List first, and make sure your problem has not been solved before.
Please search in the issue first, and make sure your problem had not been reported before
1. Versions
What is your wechaty version?
Answer: 1.20.2
Which puppet are you using for wechaty? (hostie/puppeteer/padchat/...)
Answer: puppeteer
What is your wechaty-puppet-XXX(padchat/puppeteer/) version?
Answer: wechaty-puppet-whatsapp 1.19.16
What is your node version? (run node --version)
Answer: v18.16.0
What os are you using
Answer: MacOS
2. Describe the bug
Give a clear and concise description of what the bug is.
If the previous login was successful, the program will automatically log in after restarting, but an exception is thrown: Error: Evaluation failed: Error: widToChatJid: can not convert wid to ChatJid.
I guess it's caused by cached login status.
3. To Reproduce
This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.
import { WechatyBuilder,log } from 'wechaty'
import { PuppetWhatsapp } from "wechaty-puppet-whatsapp"
import qrcodeTerminal from 'qrcode-terminal'
function onScan(qrcode, status) {
if (status === 2 || status === 5) {
const qrcodeImageUrl = [
'https://wechaty.js.org/qrcode/',
encodeURIComponent(qrcode),
].join('')
log.info('StarterBot', 'onScan: %s(%s) - %s', status, qrcodeImageUrl)
qrcodeTerminal.generate(qrcode, { small: true }) // show qrcode on console
} else {
log.info('StarterBot', 'onScan: %s(%s)', status)
}
}
function onLogin(user) {
log.info('StarterBot', '%s login', user)
}
function onLogout(user) {
log.info('StarterBot', '%s logout', user)
}
async function onMessage(msg) {
log.info('StarterBot', msg.toString())
if (msg.text() === 'ding') {
await msg.say('dong')
}
}
const bot = WechatyBuilder.build({
name: 'ding-dong-bot',
puppet: new PuppetWhatsapp()
})
bot.on('scan', onScan)
bot.on('login', onLogin)
bot.on('logout', onLogout)
bot.on('message', onMessage)
bot.start()
.then(() => log.info('StarterBot', 'Starter Bot Started.'))
.catch(e => log.error('StarterBot', e))
4. Expected behavior
Give a clear and concise description of what you expected to happen.
5. Actual behavior
If applicable, add screenshots to help explain your problem. But do not paste log screenshots here.
6. Full Output Logs
Set env WECHATY_LOG=silly in order to set log level to silly, then we can get the full log (If you dosen't set log env, log level is info as default, we cannot get the full log)
We need full log instead of log screenshot or log fragments!
Show Logs
```shell
18:14:24 INFO StarterBot Starter Bot Started.
18:14:40 INFO LoginEventHandler onAuthenticated()
18:14:40 INFO WhatsAppManager initWhatsAppEvents: "authenticated", value: undefined
18:14:40 INFO WhatsAppManager initWhatsAppEvents: "ready", value: undefined
18:14:40 INFO LoginEventHandler WhatsApp Client Info: {"pushname":"Meshlake","wid":{"server":"c.us","user":"8616601124365","_serialized":"8616601124365@c.us"},"me":{"server":"c.us","user":"8616601124365","_serialized":"8616601124365@c.us"},"platform":"iphone"}
18:14:41 INFO PuppetWhatsapp LOGIN, 8616601124365@c.us
18:14:41 INFO LoginEventHandler onLogin(8616601124365@c.us})
18:14:41 INFO StarterBot Contact login
/Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/puppeteer@13.7.0/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^
Error: Evaluation failed: Error: widToChatJid: can not convert wid to ChatJid
at e (https://web.whatsapp.com/:2:4832)
at t.widToChatJid (https://web.whatsapp.com/app.aab16172e1fa84fce9ba.js:92:315221)
at https://web.whatsapp.com/app.aab16172e1fa84fce9ba.js:49:139488
at Generator.next ()
at t (https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:66483)
at s (https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:66694)
at https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:66753
at new Promise ()
at https://web.whatsapp.com/vendor1~app.7f14216f970118f62a35.js:2:66634
at t.getProfilePic (https://web.whatsapp.com/app.aab16172e1fa84fce9ba.js:49:137813)
at ExecutionContext._evaluateInternal (/Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/puppeteer@13.7.0/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (/Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/puppeteer@13.7.0/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Client.getProfilePicUrl (/Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/@juzi+whatsapp-web.js@1.21.6/node_modules/@juzi/whatsapp-web.js/src/Client.js:1208:28)
at async PrivateContact.getProfilePicUrl (/Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/@juzi+whatsapp-web.js@1.21.6/node_modules/@juzi/whatsapp-web.js/src/structures/Contact.js:120:16)
at async file:///Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/wechaty-puppet-whatsapp@1.19.16_typescript@5.2.2_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-whatsapp/dist/esm/src/whatsapp/event-handler/login-event-handler.js:100:28
at async Promise.all (index 3)
at async batchProcess (file:///Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/wechaty-puppet-whatsapp@1.19.16_typescript@5.2.2_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-whatsapp/dist/esm/src/helper/miscellaneous.js:31:9)
at async LoginEventHandler.onReady (file:///Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/wechaty-puppet-whatsapp@1.19.16_typescript@5.2.2_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-whatsapp/dist/esm/src/whatsapp/event-handler/login-event-handler.js:98:9)
at async LoginEventHandler.onWhatsAppReady (file:///Users/ycw/code/ycw/wechaty-demo/node_modules/.pnpm/wechaty-puppet-whatsapp@1.19.16_typescript@5.2.2_wechaty-puppet@1.20.2/node_modules/wechaty-puppet-whatsapp/dist/esm/src/whatsapp/event-handler/login-event-handler.js:53:9)
```
0. Report Issue Guide
Please run the following command and check whether the problem has been fixed:
Please search in FAQ List first, and make sure your problem has not been solved before.
Please search in the issue first, and make sure your problem had not been reported before
1. Versions
Answer: 1.20.2
Answer: puppeteer
Answer: wechaty-puppet-whatsapp 1.19.16
Answer: v18.16.0
Answer: MacOS
2. Describe the bug
3. To Reproduce
4. Expected behavior
5. Actual behavior
6. Full Output Logs
We need full log instead of log screenshot or log fragments!
Show Logs
```shell 18:14:24 INFO StarterBot Starter Bot Started. 18:14:40 INFO LoginEventHandler onAuthenticated() 18:14:40 INFO WhatsAppManager initWhatsAppEvents: "authenticated", value: undefined 18:14:40 INFO WhatsAppManager initWhatsAppEvents: "ready", value: undefined 18:14:40 INFO LoginEventHandler WhatsApp Client Info: {"pushname":"Meshlake","wid":{"server":"c.us","user":"8616601124365","_serialized":"8616601124365@c.us"},"me":{"server":"c.us","user":"8616601124365","_serialized":"8616601124365@c.us"},"platform":"iphone"} 18:14:41 INFO PuppetWhatsapp LOGIN, 8616601124365@c.us 18:14:41 INFO LoginEventHandler onLogin(8616601124365@c.us}) 18:14:41 INFO StarterBot Contact7. Additional context