fix: prevent gateway crash on fetch failure with unknown cause (#3974).
This commit is contained in:
parent
5f4715acfc
commit
5ba7a36aa6
@ -84,7 +84,10 @@ export function isTransientNetworkError(err: unknown): boolean {
|
|||||||
// "fetch failed" TypeError from undici (Node's native fetch)
|
// "fetch failed" TypeError from undici (Node's native fetch)
|
||||||
if (err instanceof TypeError && err.message === "fetch failed") {
|
if (err instanceof TypeError && err.message === "fetch failed") {
|
||||||
const cause = getErrorCause(err);
|
const cause = getErrorCause(err);
|
||||||
if (cause) return isTransientNetworkError(cause);
|
// Check cause for recognized network codes if available
|
||||||
|
if (cause && isTransientNetworkError(cause)) return true;
|
||||||
|
// Fallback: "fetch failed" is inherently a network error,
|
||||||
|
// even if cause lacks standard error codes (#3974)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user