Skip to content

[ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined #212

Open
@wj-Mcat

Description

@wj-Mcat

Description

Use the latest version of wechaty docker, it will raise the error when start the grpc connection with puppet service docker server.

Packages

wechaty                           0.8.39
wechaty-grpc                      1.5.dev2
wechaty-plugin-contrib            0.0.15
wechaty-puppet                    0.4.11
wechaty-puppet-service            0.8.9
grpcio                            1.44.0
grpcio-tools                      1.44.0
grpclib                           0.4.2

Error Stack

2022-05-18 23:00:33,747 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-invite) (listenerCount:1) registering...
2022-05-18 23:00:33,747 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-join) (listenerCount:1) registering...
2022-05-18 23:00:33,747 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-leave) (listenerCount:1) registering...
2022-05-18 23:00:33,748 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-topic) (listenerCount:1) registering...
2022-05-18 23:00:33,748 - Wechaty - INFO - initPuppetEventBridge() puppet.on(scan) (listenerCount:1) registering...
2022-05-18 23:00:33,748 - Wechaty - INFO - starting puppet ...
2022-05-18 23:00:33,752 - PuppetService - INFO - init puppet ...
2022-05-18 23:00:33,761 - PuppetService - INFO - starting the puppet ...
Traceback (most recent call last):
  File "/home/wj-Mcat/projects/wechaty/python-wechaty-puppet-service/./src/wechaty_puppet_service/puppet.py", line 934, in start
    await self.puppet_stub.stop()
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/wechaty_grpc/wechaty/__init__.py", line 69, in stop
    return await self._unary_unary(
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/betterproto/grpc/grpclib_client.py", line 80, in _unary_unary
    response = await stream.recv_message()
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/grpclib/client.py", line 563, in __aexit__
    raise exc_val
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/grpclib/client.py", line 553, in __aexit__
    await self._maybe_finish()
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/grpclib/client.py", line 523, in _maybe_finish
    await self.recv_trailing_metadata()
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/grpclib/client.py", line 484, in recv_trailing_metadata
    self._raise_for_grpc_status(status, message, details)
  File "/home/wj-Mcat/miniconda3/envs/wechaty3.9/lib/python3.9/site-packages/grpclib/client.py", line 345, in _raise_for_grpc_status
    raise GRPCError(status, message, details)
grpclib.exceptions.GRPCError: (<Status.UNKNOWN: 2>, 'TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined\n    at checkListener (node:events:128:3)\n    at StateSwitch.removeListener (node:events:558:7)\n    at PuppetPadlocal._stopClient (/wechaty/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:282:20)\n    at PuppetPadlocal.stop (/wechaty/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:278:16)\n    at stop (file:///wechaty/node_modules/wechaty-puppet-service/src/server/puppet-implementation.ts:1358:18)\n    at Object.stop (file:///wechaty/node_modules/wechaty-puppet-service/src/auth/auth-impl-token.ts:49:18)\n    at handleUnary (/wechaty/node_modules/@grpc/grpc-js/src/server.ts:896:11)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)', None)

error track stack from docker(wechaty:latest)

15:02:47 VERB PuppetServiceImpl start()
15:02:47 ERR PuppetServiceImpl grpcError() start() rejection: The "listener" argument must be of type function. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined
    at checkListener (node:events:128:3)
    at _addListener (node:events:423:3)
    at StateSwitch.addListener (node:events:487:10)
    at PuppetPadlocal._startClient (/wechaty/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:145:20)
    at PuppetPadlocal.start (/wechaty/node_modules/wechaty-puppet-padlocal/src/puppet-padlocal.ts:141:16)
    at start (file:///wechaty/node_modules/wechaty-puppet-service/src/server/puppet-implementation.ts:1332:18)
    at Object.start (file:///wechaty/node_modules/wechaty-puppet-service/src/auth/auth-impl-token.ts:49:18)
    at handleUnary (/wechaty/node_modules/@grpc/grpc-js/src/server.ts:896:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Reproduction

use the latest code with python-wechaty-puppet-service

asyncio.run(Wechaty().start())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions