wechaty / wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
https://wechaty.js.org/docs/puppet-services/
317 stars 65 forks source link

room.say(file) 报错 #294

Closed przzl closed 4 years ago

przzl commented 4 years ago

Important:Please file the issue follow the template, or we won't help you to solve the problem.

0. Report Issue Guide

  1. Please run the following command and check whether the problem has been fixed:
npm install wechaty-puppet-padlus@next
  1. Please search in the issue first, and make sure your problem had not been reported before

1. Versions

2. Describe the bug

通过fromBase64转成文件后,发到群里: var base64Code = fileList[i].fileStr; var fileName = fileList[i].realFileName; const fileBox1 = FileBox.fromBase64(base64Code, fileName); room.say(fileBox1);

控制台报如下错误 (node:5780) UnhandledPromiseRejectionWarning: InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records. at Request.extractError (E:\Project\getHappy\node_modules\aws-sdk\lib\services\s3.js:837:35) at Request.callListeners (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:106:20) at Request.emit (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:78:10) at Request.emit (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:688:14) at Request.transition (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:22:10) at AcceptorStateMachine.runTo (E:\Project\getHappy\node_modules\aws-sdk\lib\state_machine.js:14:12) at E:\Project\getHappy\node_modules\aws-sdk\lib\state_machine.js:26:10 at Request. (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:38:9) at Request. (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:690:12) at Request.callListeners (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:116:18) at Request.emit (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:78:10) at Request.emit (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:688:14) at Request.transition (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:22:10) at AcceptorStateMachine.runTo (E:\Project\getHappy\node_modules\aws-sdk\lib\state_machine.js:14:12) at E:\Project\getHappy\node_modules\aws-sdk\lib\state_machine.js:26:10 at Request. (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:38:9) at Request. (E:\Project\getHappy\node_modules\aws-sdk\lib\request.js:690:12) at Request.callListeners (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:116:18) at callNextListener (E:\Project\getHappy\node_modules\aws-sdk\lib\sequential_executor.js:96:12) at IncomingMessage.onEnd (E:\Project\getHappy\node_modules\aws-sdk\lib\event_listeners.js:313:13) at IncomingMessage.emit (events.js:323:22) at IncomingMessage.EventEmitter.emit (domain.js:482:12) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:5780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by reje cting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https:// nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6) (node:5780) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

3. To Reproduce

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

Steps to reproduce the behavior:

  1. run '...'
  2. ...
  3. ...

4. Expected behavior

Give a clear and concise description of what you expected to happen.

5. Actual behavior

If applicable, add screenshots to help explain your problem. But do not paste log screenshots here.

6. Full Output Logs

Set env WECHATY_LOG=silly in order to set log level to silly, then we can get the full log (If you dosen't set log env, log level is info as default, we cannot get the full log)

We need full log instead of log screenshot or log fragments!

Show Logs ```shell $ WECHATY_LOG=silly node yourbot.js Question: Paste your FULL(DO NOT ONLY PROVIDE FRAGMENTS) log messages Answer: ```

7. Additional context

Add any other context about the problem here.

[bug]

su-chang commented 4 years ago

Please upgrade wechaty-puppet-padplus@0.7.36, this version could handle the problem.

Thank you.

przzl commented 4 years ago

请升级wechaty-puppet-padplus@0.7.36,此版本可以解决此问题。

谢谢。

出现另外一个报错;

11:52:17 INFO PadplusManager ready to restart due to receive event: reconnect 11:52:17 ERR can not get response from grpc server (node:9240) UnhandledPromiseRejectionWarning: Error: no padplus message at PadplusManager. (E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\padplus-manager\padplus-manager.js:838:23) at Generator.next () at E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\padplus-manager\padplus-manager.js:8:71 at new Promise () at __awaiter (E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\padplus-manager\padplus-manager.js:4:12) at PadplusManager.sendFile (E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\padplus-manager\padplus-manager.js:835:16) at PuppetPadplus. (E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\puppet-padplus.js:1012:56) at Generator.next () at fulfilled (E:\Project\getHappy\node_modules\wechaty-puppet-padplus\dist\src\puppet-padplus.js:5:58) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:9240) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by reje cting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https:// nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)

su-chang commented 4 years ago

Please feel free to restart the bot by yourself, and check it work or not. Thank you.

It seems that something wrong occurred in the padplus initialization.

przzl commented 4 years ago

请随时自行重启机器人,并检查其是否正常运行。谢谢。

在padplus初始化中似乎出了点问题。

电脑重启后还是不行,在机器人启动过程中,有以下几行日志。

Debugger listening on ws://127.0.0.1:61293/7170a283-b66c-4e56-9de3-c34a379d5df2 For help, see: https://nodejs.org/en/docs/inspector Debugger attached. 12:30:59 INFO PuppetPadplus start() 12:31:04 INFO PadplusManager start grpc gateway failed for reason: Error: Try to connect to server timeout., retry start in 5 seconds. 12:31:14 INFO PadplusManager start grpc gateway failed for reason: Error: Try to connect to server timeout., retry start in 5 seconds. 12:31:24 INFO PadplusManager start grpc gateway failed for reason: Error: Try to connect to server timeout., retry start in 5 seconds. 进入心跳链接

是否网络问题还是其他?

我的应用场景:机器人从第三方系统请求文件,得到文件的base64字符串及文件名,,然后转成FileBox,发出来

przzl commented 4 years ago

请随时自行重启机器人,并检查其是否正常运行。谢谢。

在padplus初始化中似乎出了点问题。

调试后发现在message.ts中uploadFile方法

const res = await this.requestClient.request({ apiType: ApiType.UPLOAD_FILE, data, })

if (res) {
  const msgDataStr = res.getData()
  if (msgDataStr) {
    const msgData: PadplusUploadFileData = JSON.parse(msgDataStr)
    return msgData.url
  } else {
    log.error(`can not parse message data from grpc`)
  }
} else {
  log.error(`can not get response from grpc server`)
}

请求的res为空导致,但是this.requestClient 和data 看起来都很正常

su-chang commented 4 years ago

Please try these commands:

rm -rf node_modules package-lock.json
npm install
npm install wechaty-puppet-padplus@latest

And then upload your file again, thank you.

su-chang commented 4 years ago

Duplicate with #295