bug: Chat transport crashes on Safari < 17.4: AbortSignal.any is not a function
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 83/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, next.js, typescript
研究方向
先閱讀 v3/sessions.js,issue 將其列為保護 AbortSignal.any 的現有範例;接著檢查 dist/esm/v3/chat.js 和 dist/esm/v3/chat-client.js 中的三個聊天傳輸呼叫點及其 CommonJS 建置版本。若要重現問題,請移除 AbortSignal.any,並執行 send 和 stream resume;當兩者在沒有此方法的情況下都能正常運作,且現有行為仍受到涵蓋時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 16.5k
- 分支
- 1.5k
- 平均合併
- 1 天 15 小時
- 30 天內合併 PR
- 17
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
triggerdotdev/trigger.dev 的其他 Issue
-
bug: retry.fetch ignores the caller's abort signal and retries aborted requests可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
triggerdotdev/trigger.dev#5116 · 2 則留言 ·
維護者通常 1 天內回覆
-
bug: Side menu items lose their active state on detail pages可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
triggerdotdev/trigger.dev#5088 ·
維護者通常 1 天內回覆
-
bug: RBAC loader logs "plugin found but failed to load" when @triggerdotdev/plugins is simply not installed可能重新可做 @itsfaryal 於 17 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
triggerdotdev/trigger.dev#5083 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 83/100
triggerdotdev/trigger.dev#5072 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
triggerdotdev/trigger.dev#5067 · 1 則留言 ·
維護者通常 1 天內回覆
查看 triggerdotdev/trigger.dev 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug platform-android
難度 2/5 1-3 小時 新手友好度 68/100
Termix-SSH/Mobile#146 · 1 則留言 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 66/100
devswha/herdr-web-ui#3875 ·
-
難度 1/5 1 小時以內 新手友好度 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
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆