Slack adapter: unfurl wait blocks webhook handling up to 2s per link (4s for edits)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start by locating enrichLinks and UNFURL_WAIT_MS in the Slack adapter, then read the link preview work in #395 to understand the intended cache behavior. Check how incoming messages and message_changed events use the enriched links. The issue is resolved when webhook handling no longer waits up to two seconds per uncached link (or the wait can be disabled) while cached previews still work.
Written by the indexing model from the issue text.
Description
Summary
@chat-adapter/slack 4.39.0 waits up to 2 seconds for link-preview (unfurl) data on every incoming message that contains a link with no cached preview. The wait runs inside webhook handling, before the event reaches the app. Links Slack never unfurls (internal admin URLs, bot posts sent with unfurl_links: false) always wait the full 2 seconds. A message_changed event parses both the old and the new text, so an edit waits twice.
Impact
Hosts that must answer Slack's webhook within a fixed window can't accept these events. We run Paperclip, which gives the SDK 2.5 seconds, so every message with an unpreviewed link and every edit gets a 503 on each retry and is eventually dropped.
Measurements
Live adapter, real bot token, one bot post with a link:
- as sent: 2,137 ms in the adapter (14 state reads of
slack:unfurls:<ts>, 150 ms apart) - same post with the link removed: 33 ms
- an edit of that post: 4,245 ms
Where
enrichLinks with UNFURL_WAIT_MS = 2e3, polling chat state every 150 ms. It looks like this arrived with the link-preview work in #395.
Suggested fix
Don't block webhook handling on unfurls: read the cached unfurl once and move on, or make the wait configurable (0 to disable). Setting UNFURL_WAIT_MS to 0 fixed it for us; one read takes about 0 ms.
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 355
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vercel/chat
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
X and Twitch: paragraphs inside a block quote are joined with no spacePossibly taken @abhiramshaji-cyber claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
Maintainers usually reply within 1 day
-
🛠️ dette technique
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
betagouv/mon-entreprise#4752 · 1 comment ·
Maintainers usually reply within 5 days
-
type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
franciscoBSalgueiro/en-croissant#1111 ·
Maintainers usually reply within 2 days
-
area/providers type/feature version/v2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#64845 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day