From 3de767fb7cc9278bf984ff88064a16e593db6db0 Mon Sep 17 00:00:00 2001 From: Merlin Beutlberger Date: Mon, 19 Jun 2023 17:19:56 +0200 Subject: [PATCH] [FIX] maven/Registry: Prevent socket timeouts when installing framework libraries Applying the fix from https://github.com/SAP/ui5-project/pull/579 in the Maven Registry module --- lib/ui5Framework/maven/Registry.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/ui5Framework/maven/Registry.js b/lib/ui5Framework/maven/Registry.js index 22e48fe97..ffac72e5e 100644 --- a/lib/ui5Framework/maven/Registry.js +++ b/lib/ui5Framework/maven/Registry.js @@ -40,7 +40,15 @@ class Registry { `${groupId.replaceAll(".", "/")}/${artifactId}/${optionalVersion}maven-metadata.xml`; log.verbose(`Fetching: ${url}`); - const res = await fetch(url); + const res = await fetch(url, { + // Disable usage of shared keep-alive agents. + // make-fetch-happen uses a hard-coded 15 seconds freeSocketTimeout + // that can be easily reached (Error: Socket timeout) and there doesn't + // seem to be another way to disable or increase it. + // Also see: https://github.com/node-modules/agentkeepalive/issues/106 + // The same applies in npm/Registry.js + agent: false, + }); if (!res.ok) { throw new Error(`[HTTP Error] ${res.status} ${res.statusText}`); } @@ -84,7 +92,15 @@ class Registry { log.verbose(`Fetching: ${url}`); const res = await fetch(url, { - cache: "no-store" // Do not cache these large artifacts. We store them right away anyways + cache: "no-store", // Do not cache these large artifacts. We store them right away anyways + + // Disable usage of shared keep-alive agents. + // make-fetch-happen uses a hard-coded 15 seconds freeSocketTimeout + // that can be easily reached (Error: Socket timeout) and there doesn't + // seem to be another way to disable or increase it. + // Also see: https://github.com/node-modules/agentkeepalive/issues/106 + // The same applies in npm/Registry.js + agent: false, }); if (!res.ok) { throw new Error(`[HTTP Error] ${res.status} ${res.statusText}`);