slackapi / slackapi/bolt-python
Lazy listeners do not work with Chalice local testing server
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.3k
- フォーク
- 288
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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