wechaty / puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
https://wechaty.js.org/docs/puppet-providers/padlocal
Apache License 2.0
642 stars 88 forks source link

friendship.accept error #40

Closed suhli closed 3 years ago

suhli commented 3 years ago

发送多次添加请求后再accept会报错

platform: MacOs 11.1 node version: v14.15.4 wechaty-puppet-padlocal version: 0.2.27 wechaty version:0.50.7

code:

this.wechaty
  .on('scan', this.onQrcode.bind(this))
  .on('login', this.login.bind(this))
  .on('friendship',  async friendship => {
      await friendship.accept();
      }
  })
  .on('message', this.onMessage.bind(this));

friendship:

{
  "contactId": "",
  "hello": "",
  "id": "6947782793190788413",
  "scene": 17,
  "stranger": "v3_020b3826fd03010000000000efba06f31dbb26000000501ea9a3dba12f95f6b60a0536a1adb6635afe82e6a7ba20ae16fc7cce3445374cd0e24ca31b1c64750107949a9464aad8519b76d162d6cb3ef5d80471b9708fb7a5afcc201052eedfeadb7ed1@stranger",
  "ticket": "v4_000b708f0b0400000100000000003e6b0a03294667fd018a56be04601000000050ded0b020927e3c97896a09d47e6e9efa2429a488ca691e44d40d88b305fec950a47a1447db389b12eaa2629b4f74d548b19a1aa759a347a94c7e0b500ea5053b339e1e151fddbab91a50ee7bd6d970811730c1ab0a5c038cdf4ebd7b5b4cf1c202d45b94e8e7c52920560b0a53184af614e2f17cfd6d56b39512ea745de0f390927dbb5f05e022a81d0c1783f97667007aa932979187e1345e0df3793bf630f367d2b57d71262adfebb038d22b9e8cfd05ed30ba9c6b88fdcd949b23a9ce42006ded950206f8dd387ec8062a4b5b896a795fe1c99a0ca477858713074e8f225beef0d77c65337b7fbce3a707a5b004824bddab66910aaade0eb47f783de6175b76d431a20c7e24cd@stranger",
  "timestamp": 1610923606,
  "type": 2
}

logs:

(node:51195) UnhandledPromiseRejectionWarning: VError: [tid:d2ac6544] request has been cancelled for reason: SERVER_ERROR: 2 UNKNOWN: [tid:d2ac6544] wechat bad request error
    at Request._failAllPendingRequest (/Users/shuhang/Document/repos/830AM-BE/node_modules/padlocal-client-ts/dist/Request.js:254:19)
    at ClientDuplexStreamImpl.<anonymous> (/Users/shuhang/Document/repos/830AM-BE/node_modules/padlocal-client-ts/dist/Request.js:55:18)
    at ClientDuplexStreamImpl.emit (events.js:315:20)
    at ClientDuplexStreamImpl.EventEmitter.emit (domain.js:485:12)
    at Object.onReceiveStatus (/Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/client.js:387:28)
    at Object.onReceiveStatus (/Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:297:181)
    at /Users/shuhang/Document/repos/830AM-BE/node_modules/@grpc/grpc-js/build/src/call-stream.js:130:78
padlocal commented 3 years ago

The error description is "user ticket invalid", make sure that the right ticket is supplied.