wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.62k stars 234 forks source link

grpc message size limit #160

Open Jasonlovesharon opened 3 years ago

Jasonlovesharon commented 3 years ago

Describe the bug Grpc max message size limit is 4MB, when I send message which size goes over the limit, I get the error.

grpclib.exceptions.GRPCError: (<Status.RESOURCE_EXHAUSTED: 8>, 'Received message larger than max (6051626 vs. 4194304)', None)

huan commented 3 years ago

Related to: https://github.com/wechaty/wechaty-puppet-hostie/issues/86

This problem is because our gRPC has added a new streaming API for large files and now we have to use streaming API for file size larger than 4MB.

This problem will be solved after the Python Wechaty has upgraded to use that new gRPC streaming API.

wj-Mcat commented 3 years ago

@Jasonlovesharon Please keep eyes on these two prs, which will fix your problem. Thanks for your issue.

Mrwyc commented 3 years ago

我使用的Python+puppet_padlocal, gRPC使用的 `export WECHATY_LOG="verbose" export WECHATY_PUPPET="wechaty-puppet-padlocal" export WECHATY_PUPPET_PADLOCAL_TOKEN="puppet_padlocal_xxxxxxxxxxxxxxxxxxxx"

export WECHATY_PUPPET_SERVER_PORT="8788" export WECHATY_TOKEN="1fe5f846-3cfb-401d-b20c-xxxx"

docker run -ti \ --name wechaty_puppet_service_token_gateway \ --rm \ -e WECHATY_LOG \ -e WECHATY_PUPPET \ -e WECHATY_PUPPET_PADLOCAL_TOKEN \ -e WECHATY_PUPPET_SERVER_PORT \ -e WECHATY_TOKEN \ -p "$WECHATY_PUPPET_SERVER_PORT:$WECHATY_PUPPET_SERVER_PORT" \ wechaty/wechaty ~ `

发送3M以下的文件都是正常发送, > 3M就发送不出去, 服务也没有出现错误 image 以下是我写的代码: file_path = os.path.join(pro_path, raw_info['attachment']) if os.path.exists(file_path): file_box = FileBox.from_file(path=file_path, name=raw_info['text']) data = await contact.say(file_box)

3M的PDF发送不出去是怎么回事, 任何文件都是一样的

huan commented 3 years ago

@wj-Mcat I believe the PR #35 might not implemented the streaming file protocol correctly, could you please have a check on that? thanks.