Skip to content

Commit 202ff53

Browse files
committed
remove logs
1 parent fb01139 commit 202ff53

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

helper-functions.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,57 +16,45 @@ function createTimeoutController(timeoutMs) {
1616
* @returns {Promise<Response>} Request response
1717
*/
1818
async function fetchWithMethodFallback(url, { signal, ...options } = {}) {
19-
console.log(`fetchWithMethodFallback START url=${url} timeoutSignalPresent=${!!signal}`);
2019
// Try HEAD first (with cf if provided)
2120
try {
22-
console.log(`fetchWithMethodFallback: attempting HEAD ${url}`);
2321
let response = await fetch(url, {
2422
method: 'HEAD',
2523
signal,
2624
cf: { cacheTtl: 0, cacheEverything: false },
2725
...options
2826
});
29-
console.log("COUCOU fetchWithMethodFallback response.status: " + response.status);
3027

3128
if (response.status === 405) {
32-
console.log(`fetchWithMethodFallback: HEAD returned 405, trying GET (with cf) ${url}`);
3329
response = await fetch(url, {
3430
method: 'GET',
3531
signal,
3632
cf: { cacheTtl: 0, cacheEverything: false },
3733
...options
3834
});
39-
console.log("fetchWithMethodFallback GET-with-cf status: " + response.status);
4035
}
4136

4237
return response;
4338
} catch (err) {
44-
console.log(`fetchWithMethodFallback: HEAD or GET-with-cf failed for ${url} -> ${err?.message || err}`);
4539
// Try GET with cf if HEAD failed, then GET without cf as a last resort
4640
try {
47-
console.log(`fetchWithMethodFallback: attempting GET (with cf) as fallback ${url}`);
4841
const response = await fetch(url, {
4942
method: 'GET',
5043
signal,
5144
cf: { cacheTtl: 0, cacheEverything: false },
5245
...options
5346
});
54-
console.log("fetchWithMethodFallback fallback GET-with-cf status: " + response.status);
5547
return response;
5648
} catch (err2) {
57-
console.log(`fetchWithMethodFallback: GET-with-cf also failed for ${url} -> ${err2?.message || err2}`);
5849
// Final attempt: GET without cf (some runtimes / dev envs reject cf option)
5950
try {
60-
console.log(`fetchWithMethodFallback: attempting GET (no cf) final fallback ${url}`);
6151
const response = await fetch(url, {
6252
method: 'GET',
6353
signal,
6454
...options
6555
});
66-
console.log("fetchWithMethodFallback fallback GET-no-cf status: " + response.status);
6756
return response;
6857
} catch (err3) {
69-
console.log(`fetchWithMethodFallback: final GET-no-cf failed for ${url} -> ${err3?.message || err3}`);
7058
// rethrow the original error to be handled by callers
7159
throw err3;
7260
}
@@ -81,28 +69,19 @@ export const HELPER = {
8169
* @returns {Promise<boolean>} true if NPM is accessible
8270
*/
8371
async isNpmUp({ timeoutMs = 10000 } = {}, env) {
84-
console.log("COUCOU1");
8572
if (!env?.NPM_HEALTH_URL) {
86-
console.log("NPM_HEALTH_URL missing");
8773
return false;
8874
}
8975
const [controller, id] = createTimeoutController(timeoutMs);
9076
try {
91-
console.log("COUCOU2");
92-
console.log("COUCOU8 NPM_HEALTH_URL: " + env.NPM_HEALTH_URL);
9377
const response = await fetchWithMethodFallback(env.NPM_HEALTH_URL, { signal: controller.signal });
94-
console.log("COUCOU3");
9578
if (HELPER.isCloudflareError(response) && response.status >= 520 && response.status <= 529) {
96-
console.log("COUCOU4");
9779
return false;
9880
}
99-
console.log("COUCOU5 response.status:: " + response.status);
10081
return response.status > 0 && response.status < 500;
10182
} catch (err) {
102-
console.log("COUCOU6 error in isNpmUp:", err?.message || err);
10383
return false;
10484
} finally {
105-
console.log("COUCOU7");
10685
clearTimeout(id);
10786
}
10887
},
@@ -117,13 +96,9 @@ export const HELPER = {
11796

11897
const [controller, id] = createTimeoutController(timeoutMs);
11998
try {
120-
console.log("COUCOU1 isOriginReachable");
121-
console.log("isOriginReachable PING_URL:", env.ORIGIN_PING_URL);
12299
const response = await fetchWithMethodFallback(env.ORIGIN_PING_URL, { signal: controller.signal });
123-
console.log("COUCOU1 isOriginReachable response:: " + (response?.status ?? 'no-response'));
124100
return response && response.status > 0 && response.status < 500;
125101
} catch (err) {
126-
console.log("isOriginReachable error:", err?.message || err);
127102
return false;
128103
} finally {
129104
clearTimeout(id);

0 commit comments

Comments
 (0)