Skip to content

Commit 7016fcf

Browse files
committed
fix(slack): strip dispatcher option before passing to globalThis.fetch
In Node.js v25, globalThis.fetch does not support the dispatcher option (only undici.fetch does). Strip dispatcher from init options while routing dispatcher-backed requests through fetchWithRuntimeDispatcher (undici.fetch). Fixes silent download-file failures on Node.js v25.
1 parent 9ffe216 commit 7016fcf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/slack/src/monitor/media.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ function createSlackMediaFetch(): FetchLike {
7777
throw new Error("Unsupported fetch input: expected string, URL, or Request");
7878
}
7979
const parsed = assertSlackFileUrl(url);
80+
const { dispatcher: _dispatcher, redirect: _redirect, ...rest } = init ?? {};
8081
const fetchImpl =
81-
"dispatcher" in (init ?? {}) && !isMockedFetch(globalThis.fetch)
82+
_dispatcher !== undefined && !isMockedFetch(globalThis.fetch)
8283
? fetchWithRuntimeDispatcher
8384
: globalThis.fetch;
84-
return fetchImpl(parsed.href, { ...init, redirect: "manual" });
85+
return fetchImpl(parsed.href, { ...rest, redirect: "manual" });
8586
};
8687
}
8788

0 commit comments

Comments
 (0)