bug: Chat transport crashes on Safari < 17.4: AbortSignal.any is not a function
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 83/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, next.js, typescript
- Ambito
- backend-api-design, frontend, web-dev
Direzione di ricerca
Inizia leggendo v3/sessions.js, che l’issue identifica come esempio esistente di protezione di AbortSignal.any; poi esamina i tre punti di chiamata del trasporto chat in dist/esm/v3/chat.js e dist/esm/v3/chat-client.js e le rispettive build CommonJS. Per riprodurre il problema, rimuovi AbortSignal.any ed esegui send e la ripresa dello stream; il lavoro è completato quando entrambi funzionano senza il metodo e il comportamento esistente continua a essere coperto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Provide environment information
System:
OS: macOS 27.0.1
CPU: (12) arm64 Apple M4 Pro
Memory: 24.00 GB
Shell: 5.9 - zsh
Binaries:
Node: 24.12.0
npm: 11.6.2
pnpm: 10.33.0
bun: 1.3.7
Affected client (end user's browser):
Safari 17.2.1 on macOS (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15)
Packages:
@trigger.dev/sdk 4.8.3 (also reproduced on 4.7.3)
ai 7.0.162
next 16 (App Router), React 19
Describe the bug
The browser-side chat transport (useTriggerChatTransport from @trigger.dev/sdk/chat/react) calls AbortSignal.any without checking that it exists. Safari only added AbortSignal.any in 17.4, so on Safari 17.0–17.3 (and 16.x) every chat request throws:
TypeError: AbortSignal.any is not a function. (In 'AbortSignal.any([t,o.signal])', 'AbortSignal.any' is undefined)
at subscribeToSessionStream
The AI SDK always passes an abortSignal to sendMessages / reconnectToStream, so the AbortSignal.any branch is hit on every send and every resume. Chat is unusable for these users.
Next.js supports Safari 16.4+ by default, so these browsers are still in the supported range for most apps using the SDK.
Unguarded call sites in 4.8.3:
- dist/esm/v3/chat.js:614 (reconnectToStream)
- dist/esm/v3/chat.js:1210 (subscribeToSessionStream)
- dist/esm/v3/chat-client.js:571
(and the matching commonjs builds)
Reproduction repo
No standalone repo. Any app that uses useTriggerChatTransport with useChat reproduces it on Safari < 17.4, or on any browser after removing the method (see steps below).
To reproduce
- Set up a chat using
useTriggerChatTransportfrom@trigger.dev/sdk/chat/reactwithuseChatfrom@ai-sdk/react. - Open the app in Safari 17.2 (or any Safari < 17.4).
Alternatively, in any modern browser, rundelete AbortSignal.anyin the devtools console before the chat mounts. - Send a message, or reload a page with an active chat so it resumes the stream.
- The transport throws
TypeError: AbortSignal.any is not a functionand the chat request fails.
Suggested fix
v3/sessions.js already guards this for Node 18 (if (typeof AbortSignal.any === "function") ... else { wire the caller signal manually }). Applying the same guard, or a small shared helper, to the chat transport would fix it. For example:
function anySignal(signals: AbortSignal[]): AbortSignal {
if (typeof AbortSignal.any === "function") return AbortSignal.any(signals);
const controller = new AbortController();
const aborted = signals.find((s) => s.aborted);
if (aborted) {
controller.abort(aborted.reason);
return controller.signal;
}
for (const s of signals) {
s.addEventListener("abort", () => controller.abort(s.reason), {
once: true,
signal: controller.signal,
});
}
return controller.signal;
}
and use it at the three call sites in chat.js and chat-client.js.
Additional information
We've worked around it on our side by polyfilling AbortSignal.any in instrumentation-client.ts. It would still be good to fix in the SDK, since apps using the chat transport won't know they need the polyfill until older-Safari users report broken chat.
- Lingua principale
- TypeScript
- Stelle
- 16.5k
- Fork
- 1.5k
- Merge medio
- 1g 15h
- PR unite (30g)
- 17
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di triggerdotdev/trigger.dev
-
bug: retry.fetch ignores the caller's abort signal and retries aborted requestsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
triggerdotdev/trigger.dev#5116 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug: Side menu items lose their active state on detail pagesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
triggerdotdev/trigger.dev#5088 ·
I maintainer di solito rispondono entro 1 giorno
-
bug: RBAC loader logs "plugin found but failed to load" when @triggerdotdev/plugins is simply not installedForse di nuovo libera @itsfaryal l’ha presa 17 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
triggerdotdev/trigger.dev#5083 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
triggerdotdev/trigger.dev#5072 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
triggerdotdev/trigger.dev#5067 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di triggerdotdev/trigger.dev
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug platform-android
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Termix-SSH/Mobile#146 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
devswha/herdr-web-ui#3875 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
area: runtime chore cli consistency dependencies developer-experience difficulty: easy discovery documentation enhancement good first issue help wanted hygiene json-output packaging priority: P3 tests version
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno