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

Aperta
#1,132 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@KingEmma7 ci sta già lavorando.

Dal 12/11/2026.

  • #1150 di @KingEmma7 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api, backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
2.5k
Fork
355
Merge medio
2g 15h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/chat

Tutte le issue di vercel/chat

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.