wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
774 stars 342 forks source link

wechaty-getting-started not working properly over wechaty 1.xx #255

Open atorber opened 2 years ago

atorber commented 2 years ago

I used puppet-wxwork and puppet-padlocal to run wechaty-getting-started with npm start.

There seems to be some problems. Neither puppet works normally.

Test puppet-wxwork

Env:

wechaty-getting-started: 1.18.4
wechaty-puppet-service:1.18.2
wechaty: 1.18.1
node: v16.13.1
npm: 8.1.2
OS: macOS Monterey 12.0.1

Err

23:48:02 VERB GrpcManager initClient() TLS: enabled
23:48:02 VERB GrpcManager initClient() ... done
23:48:02 VERB GrpcManager start() initializing client ... done
23:48:02 VERB GrpcManager start() starting stream ...
23:48:02 VERB GrpcManager startStream()
23:48:02 VERB GrpcManager startStream() grpc -> event() ...
23:48:02 VERB GrpcManager startStream() grpc -> event() ... done
23:48:02 VERB GrpcManager startStream() grpc -> event peeking data or timeout ...
23:48:05 VERB GrpcManager startStream() grpc -> event peeking data or timeout ... timeout
23:48:05 VERB GrpcManager startStream() grpc -> event peeking data or timeout ... data peeked
23:48:05 VERB GrpcManager startStream() initializing event stream ...
23:48:05 VERB GrpcManager startStream() initializing event stream ... done
23:48:05 VERB GrpcManager startStream() ... done
23:48:05 VERB GrpcManager start() starting stream ... done
23:48:05 VERB GrpcManager start() calling grpc server: start() ...
23:48:05 ERR StarterBot Error: 14 UNAVAILABLE: No connection established

Test puppet-padlocal

Env:

wechaty-getting-started: 1.18.4
wechaty-puppet-padlocal:0.4.2
wechaty: 1.18.1
node: v16.13.1
npm: 8.1.2
OS: macOS Monterey 12.0.1

Err

23:59:27 VERB WechatyPuppetMixin init() emitting "puppet" event ...
23:59:27 VERB WechatyPuppetMixin init() emitting "puppet" event ... done
23:59:27 VERB ServiceCtl<Wechaty> start()
23:59:27 VERB StateSwitch <Wechaty> active(pending) <- (false)
23:59:27 VERB ServiceCtl<Wechaty> start() super.start() ...
23:59:27 VERB WechatyPuppetMixin start()
23:59:27 VERB WechatyPuppetMixin start() super.start() ...
23:59:27 VERB WechatyIoMixin start()
23:59:27 VERB WechatySkeleton start()
23:59:27 VERB WechatyLoginMixin init()
23:59:27 VERB WechatyPuppetMixin init()
23:59:27 VERB WechatifyUserModuleMixin init()
23:59:27 VERB WechatySkeleton init()
23:59:27 VERB WechatifyUserModuleMixin init() Wechaty User Module (WUM)s have already wechatified: skip
23:59:27 VERB WechatyPuppetMixin init() skipped because this puppet has already been inited before.
23:59:27 VERB WechatyPuppetMixin start() super.start() ... done
23:59:27 VERB WechatyPuppetMixin start() starting puppet ...
23:59:27 ERR StarterBot TypeError: The "listener" argument must be of type function. Received undefined
choogoo@Tommys-MacBook-Pro getting-started % 
huan commented 2 years ago

PadLocal requires Wechaty Gateway (for now)

PadLocal has to use a token gateway for v1.x because it's not finished upgrading yet.

Here's the ongoing PR to fix it:

PadLocal Workaround

Using a Wechaty Token Gateway.

Here's how Friday makes it: https://github.com/wechaty/friday/blob/main/scripts/token-gateway.sh

Explanation: use wechaty@0.78 to convert Puppet PadLocal to a standard Puppet Service, then use Wechaty@1.x with this new service via gRPC and a new token.

WXWork requires disable TLS (for now)

WXWork has to disable TLS when you are using Wechaty v1.x because it does not support TLS yet.

Here's the related issue for the details:

WXWork Workaround

WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT=true npm start