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

[FEAT]WorkPro: chatbot stops receiving messages after 3 to 4 days and encounters a log error #579

Open
junmo1215 opened this issue Sep 30, 2024 · 1 comment
Assignees
Labels
workpro Wechaty Puppet Service WorkPro

Comments

@junmo1215
Copy link

Describe the bug

I implemented my chatbot using Wechaty (WorkPro). Initially, when I start my service, it can send and receive messages normally. However, after 3 to 4 days, it stops receiving messages. Checking the logs reveals the following error, and no further logs are printed afterward.

17:14:33 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:28)})
17:14:48 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:28)})
17:15:03 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:28)})
17:15:18 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:28)})
17:15:33 VERB PuppetService onGrpcStreamEvent({type:EVENT_TYPE_HEARTBEAT(1), payload(len:28)})
17:15:35 ERR Config ###########################
17:15:35 ERR Config Wechaty uncaughtException: Error: 1 CANCELLED: Call cancelled
    at callErrorFromStatus (/app/wechaty/node_modules/@grpc/grpc-js/src/call.ts:82:17)
    at Object.onReceiveStatus (/app/wechaty/node_modules/@grpc/grpc-js/src/client.ts:611:51)
    at Object.onReceiveStatus (/app/wechaty/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
    at /app/wechaty/node_modules/@grpc/grpc-js/src/resolving-call.ts:132:24
    at processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at ServiceClientImpl.makeServerStreamRequest (/app/wechaty/node_modules/@grpc/grpc-js/src/client.ts:594:42)
    at ServiceClientImpl.event (/app/wechaty/node_modules/@grpc/grpc-js/src/make-client.ts:189:15)
    at GrpcManager.startStream (/app/wechaty/node_modules/wechaty-puppet-service/src/client/grpc-manager.ts:298:37)
    at GrpcManager.start (/app/wechaty/node_modules/wechaty-puppet-service/src/client/grpc-manager.ts:160:16)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async PuppetService.onStart (/app/wechaty/node_modules/wechaty-puppet-service/src/client/puppet-service.ts:173:5)
    at async PuppetService.start (/app/wechaty/node_modules/state-switch/src/service-ctl/service-ctl.ts:89:9)
    at async PuppetService.start (/app/wechaty/node_modules/wechaty-puppet/src/mixins/service-mixin.ts:34:7)
    at async PuppetService.start (/app/wechaty/node_modules/wechaty-puppet/src/mixins/ready-mixin.ts:24:7)
    at async WechatyImpl.start (/app/wechaty/node_modules/wechaty/src/wechaty-mixins/puppet-mixin.ts:83:11) uncaughtException
17:15:35 ERR Config ###########################
17:15:35 VERB PuppetService bridgeGrpcEventStream() eventStream.on(end)
17:15:36 WARN ResolverWechaty updateResolution() address not found target wechaty://token-service-discovery-test.juzibot.com/puppet_workpro_{my token}: token does not exist
17:16:33 WARN PuppetWatchdogAgent start() reset() reason: {"data":"regular heartbeat","timeoutMilliseconds":60000}
17:16:33 ERR Config ###########################
17:16:33 ERR Config Wechaty uncaughtException: Error: WatchdogAgent reset: lastFood: "{"data":"regular heartbeat","timeoutMilliseconds":60000}"
    at Watchdog.reset (/app/wechaty/node_modules/wechaty-puppet/src/agents/watchdog-agent.ts:65:33)
    at Watchdog.emit (node:events:519:28)
    at Watchdog.emit (node:domain:488:12)
    at Timeout._onTimeout (/app/wechaty/node_modules/watchdog/src/watchdog.ts:115:12)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) uncaughtException
17:16:33 ERR Config ###########################

Info

  • Platform[e.g. Windows/Mac/Linux]: Docker (Base image node:21.5.0)
  • Runtime version[e.g. node/JAVA]: node
  • Wechaty version: "wechaty": "^1.20.2"
  • Wechaty Puppet version: wechaty-puppet-service-1.19.9

To Reproduce

Steps to reproduce the behavior:
Start my app with the fellowing code and wait:

const wechaty_bot = WechatyBuilder.build({
  name: 'xxx'
})

wechaty_bot.on('scan',    onScan)
wechaty_bot.on('login',   onLogin)
wechaty_bot.on('logout',  onLogout)
wechaty_bot.on('message', onMessage)

CmdHelper.set_bot(wechaty_bot);

wechaty_bot.start()
  .then(() => {
    log.info('StarterBot', 'Starter Bot Started.')
  })
  .catch(e => log.error('StarterBot', 'Failed to start the bot:', e))

Additional context

  • I have a wechat and whatsapp chatbot using the same code, they are all work well, only workpro chatbot have this issue
  • I have set these env variable:
    • WECHATY_PUPPET: wechaty-puppet-service
    • WECHATY_PUPPET_SERVICE_TOKEN: puppet_workpro_{my token}
    • WECHATY_PUPPET_SERVICE_AUTHORITY: token-service-discovery-test.juzibot.com
    • WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT: "true"
      WECHATY_PUPPET_SERVICE_NO_SSL_UNSAFE_CLIENT: "true"
@junmo1215 junmo1215 added the workpro Wechaty Puppet Service WorkPro label Sep 30, 2024
@hcfw007
Copy link
Member

hcfw007 commented Oct 17, 2024

这说明你本地与远程服务器连接断了。请监听 error 事件并编码重连。

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

No branches or pull requests

3 participants