Slack adapter: unfurl wait blocks webhook handling up to 2s per link (4s for edits)

Open
#1,132 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@KingEmma7 is already working on this.

Since Nov 12, 2026.

  • #1150 by @KingEmma7 — open

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
Domain
api, backend

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vercel/chat

All issues in vercel/chat

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.