From 34ab5e945a8be4cff945f031c5d4257e0ff91d6c Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Tue, 6 Aug 2024 10:18:09 +0200 Subject: [PATCH 1/2] fix: Guard getReader function for other fetch implementations --- packages/utils/src/instrument/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/src/instrument/fetch.ts b/packages/utils/src/instrument/fetch.ts index afa209c01929..508337f9cefe 100644 --- a/packages/utils/src/instrument/fetch.ts +++ b/packages/utils/src/instrument/fetch.ts @@ -116,7 +116,7 @@ function instrumentFetch(onFetchResolved?: (response: Response) => void, skipNat } async function resolveResponse(res: Response | undefined, onFinishedResolving: () => void): Promise { - if (res && res.body) { + if (res && res.body && typeof res.body.getReader === 'function') { const responseReader = res.body.getReader(); // eslint-disable-next-line no-inner-declarations From 7408b792b77c3d3ce058bb50523d089f82f48788 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Tue, 6 Aug 2024 10:39:35 +0200 Subject: [PATCH 2/2] simplify check --- packages/utils/src/instrument/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/src/instrument/fetch.ts b/packages/utils/src/instrument/fetch.ts index 508337f9cefe..a161b8db79bb 100644 --- a/packages/utils/src/instrument/fetch.ts +++ b/packages/utils/src/instrument/fetch.ts @@ -116,7 +116,7 @@ function instrumentFetch(onFetchResolved?: (response: Response) => void, skipNat } async function resolveResponse(res: Response | undefined, onFinishedResolving: () => void): Promise { - if (res && res.body && typeof res.body.getReader === 'function') { + if (res && res.body && res.body.getReader) { const responseReader = res.body.getReader(); // eslint-disable-next-line no-inner-declarations