wechaty / puppet-supports

Wechaty Puppet Services (WPS)
https://wechaty.js.org/docs/puppet-services/
Apache License 2.0
33 stars 4 forks source link

[BUG]WorkPro: bot exist with error #492

Closed Emirateyang closed 5 months ago

Emirateyang commented 5 months ago

Please make sure you have read the Wechaty Puppet Service: WorkPro from Wechaty Official Website before you continue writing this issue.

IMPORTANT

DO NOT post your token in the issue. If we need to investigate the behavior of certain token, we will provide a private contact route.

Describe the bug

bot exist with error and can not reboot again

Info

To Reproduce

Expected behavior

what can i do to void this exception.

Screenshots

06:15:09 INFO PuppetService messageSend(R:10852421863727131, @A00王生 您好,请问有什么可以帮到您的吗?) about to call grpc 06:15:09 INFO PuppetService messageSend(R:10852421863727131, @A00王生 您好,请问有什么可以帮到您的吗?) grpc called, messageId: aa4a9dc6443e2fcd072de03330f0c428 /usr/src/wechat-com-bot/node_modules/@juzi/wechaty-puppet/src/mixins/cache-mixin.ts:120 const frags = id.split(STRING_SPLITTER) ^ TypeError: Cannot read properties of undefined (reading 'split') at 4 (/usr/src/wechat-com-bot/node_modules/@juzi/wechaty-puppet/src/mixins/cache-mixin.ts:120:28) at PuppetService.onDirty (/usr/src/wechat-com-bot/node_modules/@juzi/wechaty-puppet/src/mixins/cache-mixin.ts:134:7) at PuppetService.emit (node:events:525:35) at PuppetService.emit (node:domain:489:12) at PuppetService.emit (/usr/src/wechat-com-bot/node_modules/@juzi/wechaty-puppet/src/puppet/puppet-skeleton.ts:117:20) at PuppetService.onGrpcStreamEvent (/usr/src/wechat-com-bot/node_modules/@juzi/wechaty-puppet-service/src/client/puppet-service.ts:329:14) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

Additional context

su-chang commented 5 months ago

看起来是id的数据有问题,导致了这个问题。最好能提供下复现步骤。

Emirateyang commented 5 months ago

用户就问了几个问题就貌似出错退出程序了,然后再想启动就启动不起来,错误的地方是一样的。 目前只能让机器人的企微账号在企微app端主动退出,再次登录后,可以重新启动服务了

我就是想问一下,这种情况,是不是可以捕获后不处理,否则影响服务,导致其它人都不能使用了 我应该怎么处理比较好

hcfw007 commented 5 months ago

这个你只要用 bot.on('error') 监听事件然后忽略即可。

Emirateyang commented 5 months ago

@hcfw007 我们确实监听后啥也没做 .on('error', err => { logger.error(err) } 但是bot启动就直接抛出,最上边描述的错误,导致机器人服务起不来

hcfw007 commented 5 months ago

请使用 @juzi 版本的 wechaty 相关包试试

Emirateyang commented 5 months ago
"@juzi/wechaty": "^1.0.99",
"@juzi/wechaty-puppet": "^1.0.90",
"@juzi/wechaty-puppet-service": "^1.0.97",

这是我使用的相关包

hcfw007 commented 5 months ago

我能连你的 token 在这个群发相同的信息试试吗?

Emirateyang commented 5 months ago

@hcfw007 因为是周末,着急。所以我已经让机器人的那个账号在企微app端退出后,重新扫码登录了,现在没有再出现了,我就想以后万一还有这种情况,就想看看怎么从代码逻辑这块修改后可以避免这个情况

hcfw007 commented 5 months ago

从你的描述看,使用了 @juzi 版本并且监听了 error 事件,应该是不会导致错误的。。。

Emirateyang commented 5 months ago

是吧,这个问题我先关闭,如果下次真的还遇到问题,我再@你,帮我们看看吧

Emirateyang commented 5 months ago

@hcfw007 感谢