Kabuda-czh / koishi-plugin-kbot

GNU Affero General Public License v3.0
33 stars 4 forks source link

bilibili/twitter图片渲染失败 #79

Open tiehu opened 10 months ago

tiehu commented 10 months ago

故障表现:

使用bilibili/twitter -s uid获取动态时,bot回复“发生未知错误”,日志中出现报错(附在下方)。

预期行为:

bot正常返回动态图片。

复现步骤:

1.打开kbot配置中的B站或推特订阅功能。 2.启用图片模式。 3.在沙箱/平台环境下使用bilibili/twitter -s uid获取动态 PS:复现概率似乎不是百分百,有时候能成功获取,有时候就会报错。

相关日志:

B站动态获取时报错如下: [W] app Error: property puppeteer is not registered, declare it as inject to suppress this warning at checkInject (/home/koishi-app/node_modules/cordis/lib/index.cjs:780:36) at Object.get (/home/koishi-app/node_modules/cordis/lib/index.cjs:797:9) at renderFunction (/home/koishi-app/node_modules/koishi-plugin-kbot/lib/plugins/bilibili/dynamic/render.js:27:21) at Object.bilibiliSearch [as search] (/home/koishi-app/node_modules/koishi-plugin-kbot/lib/plugins/bilibili/dynamic/common.js:238:44) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Array. (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1331:14) at async _Command.execute (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1346:22) at async /home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2175:22 at async _Session.withScope (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2077:22) at async next (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) [W] app Error: property puppeteer is not registered, declare it as inject to suppress this warning at checkInject (/home/koishi-app/node_modules/cordis/lib/index.cjs:780:36) at Object.get (/home/koishi-app/node_modules/cordis/lib/index.cjs:797:9) at pcRenderImage (/home/koishi-app/node_modules/koishi-plugin-kbot/lib/plugins/bilibili/dynamic/render.js:53:26) at async Array. (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1331:14) at async _Command.execute (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1346:22) at async /home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2175:22 at async _Session.withScope (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2077:22) at async next (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async _Processor._handleMessage (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1064:22) [W] command bilibili -s 8047632 Error: Cannot read properties of null (reading 'screenshot') at coerce (/home/koishi-app/node_modules/@koishijs/utils/lib/index.cjs:90:72) at _Command.execute (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1355:46) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async /home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2175:22 at async _Session.withScope (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2077:22) at async next (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async _Processor._handleMessage (/home/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1064:22)

推特获取订阅时也有报错: [E] KBot-twitter-dynamic 推特图片渲染失败: TypeError: Cannot read properties of null (reading 'screenshot') at renderImage (/root/koishi-app/node_modules/koishi-plugin-kbot/lib/plugins/twitter/dynamic/render.js:77:80) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Array. (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1331:14) at async _Command.execute (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1346:22) at async /root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2175:22 at async _Session.withScope (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2077:22) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async _Processor._handleMessage (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1064:22) [W] command twitter -s X Error: Cannot read properties of null (reading 'screenshot') at coerce (/root/koishi-app/node_modules/@koishijs/utils/lib/index.cjs:90:72) at _Command.execute (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1355:46) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async /root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2175:22 at async _Session.withScope (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:2077:22) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async next (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1053:16) at async _Processor._handleMessage (/root/koishi-app/node_modules/@koishijs/core/lib/index.cjs:1064:22)

环境信息:

系统:Ubuntu 22.04 LTS 架构:ARM64 Node:20.8.1 NPM:10.1.0 Koishi:4.15.3 kbot版本:1.1.3-alpha.1 PS:同时,该问题也可在koishi-android上复现。

其他信息:

body命令渲染的状态图是可以正常获取的,所以应该不是我puppeteer插件配置错误。

Kabuda-czh commented 9 months ago

请确认自己有没有正常启动 puppeteer

tiehu commented 9 months ago

请确认自己有没有正常启动 puppeteer

puppeteer显示是正常运行的,body命令和其他插件也可以正常渲染图片,所以puppeteer应该是正常启动了