mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 02:40:22 +00:00
fix: normalize abort signals for telegram fetch
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { wrapFetchWithAbortSignal } from "../infra/fetch.js";
|
||||
|
||||
// Bun-only: force native fetch to avoid grammY's Node shim under Bun.
|
||||
export function resolveTelegramFetch(proxyFetch?: typeof fetch): typeof fetch | undefined {
|
||||
if (proxyFetch) return proxyFetch;
|
||||
if (proxyFetch) return wrapFetchWithAbortSignal(proxyFetch);
|
||||
const fetchImpl = globalThis.fetch;
|
||||
const isBun = "Bun" in globalThis || Boolean(process?.versions?.bun);
|
||||
if (!isBun) return undefined;
|
||||
if (!fetchImpl) {
|
||||
throw new Error("fetch is not available; set channels.telegram.proxy in config");
|
||||
}
|
||||
return fetchImpl;
|
||||
return wrapFetchWithAbortSignal(fetchImpl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user