-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Labels
Description
Description
When using the async Bolt for Python SDK (slack_bolt==1.23.0), I noticed that calling await ack() inside an event handler (e.g., app_mention) sometimes takes around 3 seconds due to network delays. This delay causes Slack to resend the event multiple times because it does not receive the acknowledgment promptly.
Reproduction Steps
- Set up an async Bolt app with event handler for app_mention.
- Call await ack() inside the handler.
- Deploy the app.
- Mention the bot in Slack.
- Observe that if await ack() is delayed (~3 seconds), Slack retries the event, causing duplicates.
Expected behavior
ack() should respond immediately to Slack’s event request to prevent retries, even if the rest of the event processing takes longer.
Actual behavior
await ack() delays due to network latency and event processing, causing Slack to resend the event multiple times.
Code snippet
@app.event("app_mention")
async def bot_mention(event, body, say, client, logger, ack):
await ack() # This sometimes takes ~3 seconds due to network delay
# Additional event processing...
Environment
slack_bolt==1.23.0
slack_sdk==3.36.0
Bolt for Python (async)
Slack workspace with necessary permissions and subscriptions
Python 3.8+