slackapi / slackapi/bolt-python
Lazy listeners do not work with Chalice local testing server
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.3k
- 派生
- 288
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 10
描述
I want to perform operations when a member has joined a channel which takes more than 5 seconds, but I'm getting BrokenPipeError: [Errno 32] Broken pipe.
The minimal step to reproduce the same has been shown below while using the lazy listener it waits for 10 seconds before responding back.
Reproducible in:
from chalice import Chalice, Response
from slack_bolt import App
from slack_bolt.adapter.aws_lambda.chalice_handler import ChaliceSlackRequestHandler
bolt_app = App(process_before_response=True)
app = Chalice(app_name='chalice_app_name')
slack_handler = ChaliceSlackRequestHandler(app=bolt_app, chalice=app)
@bolt_app.event("message")
def handle_message_events(body, logger):
logger.info(body['event']['text'])
def respond_to_slack_within_3_seconds(ack):
ack("Accepted!")
def say_it(say):
time.sleep(10)
say("Done!")
bolt_app.event("member_joined_channel")(
ack=respond_to_slack_within_3_seconds, lazy=[say_it]
)
@app.route(
"/slack/events",
methods=["POST"],
content_types=["application/x-www-form-urlencoded", "application/json"],
)
def events() -> Response:
return slack_handler.handle(app.current_request)
The slack_bolt version
slack-bolt==1.9.1
slack-sdk==3.11.1
Python runtime version
Python 3.6.15
OS info
Ubuntu 20.04.3 LTS
Steps to reproduce:
- While handling of any Slack event (e.g. handle_member_joined event)
- Use lazy listener and wait for more than 3 seconds before responding back to Slack
Expected result:
Since the event is acknowledging the Slack within 3 seconds irrespective of the lazy listener function time, it should have processed the same.
Actual result:


Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 ChaliceSlackRequestHandler 入口点开始,在启用 process_before_response 的情况下,使用一个休眠 10 秒的 lazy listener 重现 member_joined_channel 事件。检查本地测试服务器围绕 /slack/events 响应的行为,并确认在发送 acknowledgement 后,lazy listener 能够在不出现 BrokenPipeError 的情况下完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- aws, python
- 领域
- api, backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100