AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug]企业微信客服回调提示openapi回调地址请求不通过

Open laopanmemz opened this issue 1 year ago • 3 comments

发生了什么

企业微信客服配置那里,在正确填写Token和EncodingAESKey后,保存提示openapi回调地址请求不通过

如何复现?

配置AstrBot适配器和企业微信客服企业内部接入,填写完成后保存适配器配置和企微接入配置

AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

v3.5.7,Windows一键部署,wecom企业微信适配器

操作系统

Windows

报错日志

[19:10:26] [Core] [INFO] [wecom.wecom_adapter:61]: 验证请求有效性: ImmutableMultiDict([('msg_signature', 'b5325a421774fdc3cb536dc55846cb734909c210'), ('timestamp', '1746529826'), ('nonce', '1746458576'), ('echostr', 'TAjqACXDT1kskqBUipGZUvpILPGoVrEKEhk36JgIjnEzKn0rzwBIwY/tL+CzjYbTnxl3uSosQizNj7ipjRohRg==')]) --- Logging error --- Traceback (most recent call last): File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1464, in handle_request return await self.full_dispatch_request(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1502, in full_dispatch_request result = await self.handle_user_exception(error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1059, in handle_user_exception raise error File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1500, in full_dispatch_request result = await self.dispatch_request(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1597, in dispatch_request return await self.ensure_async(handler)(**request_.view_args) # type: ignore[return-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\astrbot\core\platform\sources\wecom\wecom_adapter.py", line 64, in verify echo_str = self.crypto.check_signature( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\enterprise\crypto.py", line 23, in check_signature return self.check_signature( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\crypto_init.py", line 61, in _check_signature return pc.decrypt(echo_str, self._id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\enterprise\crypto.py", line 13, in decrypt return self._decrypt(text, corp_id, InvalidCorpIdException) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\crypto\base.py", line 51, in _decrypt raise exception() wechatpy.enterprise.exceptions.InvalidCorpIdException: Error code: -40005, message: Invalid corp_id

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python311\Lib\logging_init_.py", line 449, in format return self.format(record) ^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init.py", line 445, in _format return self._fmt % values ~~~~~~~~~~^~~~~~~~ KeyError: 'plugin_tag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python311\Lib\logging_init_.py", line 1110, in emit msg = self.format(record) ^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 953, in format return fmt.format(record) ^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 690, in format s = self.formatMessage(record) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\colorlog\formatter.py", line 133, in formatMessage message = super().formatMessage(wrapper) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 659, in formatMessage return self.style.format(record) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init.py", line 451, in format raise ValueError('Formatting field not found in record: %s' % e) ValueError: Formatting field not found in record: 'plugin_tag' Call stack: File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\main.py", line 83, in asyncio.run(core_lifecycle.start()) File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 637, in run_until_complete self.run_forever() File "C:\Program Files\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 604, in run_forever self._run_once() File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 1909, in _run_once handle._run() File "C:\Program Files\Python311\Lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self.args) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\asgi.py", line 108, in handle_request response = await self.app.handle_request(request) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1468, in handle_request return await self.handle_exception(error) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1087, in handle_exception self.log_exception(exc_info) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1145, in log_exception self.logger.error( Message: 'Exception on request GET /callback/command' Arguments: () [2025-05-06 19:10:26 +0800] [7536] [ERROR] Error in ASGI Framework Traceback (most recent call last): File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1464, in handle_request return await self.full_dispatch_request(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1502, in full_dispatch_request result = await self.handle_user_exception(error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1059, in handle_user_exception raise error File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1500, in full_dispatch_request result = await self.dispatch_request(request_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1597, in dispatch_request return await self.ensure_async(handler)(**request.view_args) # type: ignore[return-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\astrbot\core\platform\sources\wecom\wecom_adapter.py", line 64, in verify echo_str = self.crypto.check_signature( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\enterprise\crypto.py", line 23, in check_signature return self.check_signature( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\crypto_init.py", line 61, in _check_signature return pc.decrypt(echo_str, self._id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\enterprise\crypto.py", line 13, in decrypt return self._decrypt(text, corp_id, InvalidCorpIdException) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\wechatpy\crypto\base.py", line 51, in _decrypt raise exception() wechatpy.enterprise.exceptions.InvalidCorpIdException: Error code: -40005, message: Invalid corp_id

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Python311\Lib\logging_init_.py", line 449, in format return self.format(record) ^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init.py", line 445, in _format return self._fmt % values ~~~~~~~~~~^~~~~~~~ KeyError: 'plugin_tag'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\hypercorn\asyncio\task_group.py", line 27, in handle await app(scope, receive, send, sync_spawn, call_soon) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\hypercorn\app_wrappers.py", line 34, in call await self.app(scope, receive, send) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1735, in call await self.asgi_app(scope, receive, send) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1761, in asgi_app await asgi_handler(receive, send) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\asgi.py", line 60, in call raise_task_exceptions(done) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\utils.py", line 186, in raise_task_exceptions raise task.exception() File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\asgi.py", line 110, in handle_request response = await handle_exception(self.app, error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\asgi.py", line 408, in handle_exception raise error File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\asgi.py", line 108, in handle_request response = await self.app.handle_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1468, in handle_request return await self.handle_exception(error) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1087, in handle_exception self.log_exception(exc_info) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\quart\app.py", line 1145, in log_exception self.logger.error( File "C:\Program Files\Python311\Lib\logging_init.py", line 1518, in error self.log(ERROR, msg, args, **kwargs) File "C:\Program Files\Python311\Lib\logging_init.py", line 1634, in log self.handle(record) File "C:\Program Files\Python311\Lib\logging_init.py", line 1644, in handle self.callHandlers(record) File "C:\Program Files\Python311\Lib\logging_init.py", line 1706, in callHandlers hdlr.handle(record) File "C:\Program Files\Python311\Lib\logging_init.py", line 978, in handle self.emit(record) File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\astrbot\core\log.py", line 144, in emit log_entry = self.format(record) ^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 953, in format return fmt.format(record) ^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 690, in format s = self.formatMessage(record) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\AllForBot\AstrBotLauncher-0.1.5.6\AstrBot\venv\Lib\site-packages\colorlog\formatter.py", line 133, in formatMessage message = super().formatMessage(wrapper) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init_.py", line 659, in formatMessage return self.style.format(record) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\logging_init.py", line 451, in format raise ValueError('Formatting field not found in record: %s' % e) ValueError: Formatting field not found in record: 'plugin_tag' [2025-05-06 19:10:26 +0800] [7536] [INFO] 14.116.241.251:40770 GET /callback/command 1.1 500 - 30850

你愿意提交 PR 吗?

  • [ ] 是的,我愿意提交 PR!

Code of Conduct

  • [x] 我已阅读并同意遵守该项目的 行为准则。

laopanmemz avatar May 06 '25 11:05 laopanmemz

你可以先去https://work.weixin.qq.com/wework_admin/frame#profile 这个地方找到自己的企业id,然后你再配置AstrBot时,除了Token和EncodingAESKey,再把自己的企业id加上去,然后再点“完成”就可以了

Jia0029 avatar May 06 '25 11:05 Jia0029

你可以先去 https://work.weixin.qq.com/wework_admin/frame#profile 这个地方找到自己的企业id,然后你再配置AstrBot时,除了Token和EncodingAESKey,再把自己的企业id加上去,然后再点“完成”就可以了

好的谢谢,现在验证通过了

laopanmemz avatar May 06 '25 11:05 laopanmemz

为啥新版本没有填写企业微信ID 的地方了?

vonch avatar Oct 31 '25 06:10 vonch