From 2de96b98f27a4a99ade6dd2a80f2320492a69338 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Mon, 15 Apr 2024 20:17:04 +0100 Subject: [PATCH] chore: update log --- packages/crypto/src/lib/crypto.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/crypto/src/lib/crypto.ts b/packages/crypto/src/lib/crypto.ts index 8bb24faf91..ea242f6451 100644 --- a/packages/crypto/src/lib/crypto.ts +++ b/packages/crypto/src/lib/crypto.ts @@ -377,7 +377,7 @@ async function getAmdCert(url: string): Promise { const proxyUrl = `${LIT_CORS_PROXY}/${url}`; log( - `[getAmdCert] Fetching AMD cert using proxy URL ${proxyUrl} due to CORS restrictions.` + `[getAmdCert] Fetching AMD cert using proxy URL ${proxyUrl} to manage CORS restrictions and to avoid being rate limited by AMD.` ); async function fetchAsUint8Array(targetUrl) { @@ -397,15 +397,13 @@ async function getAmdCert(url: string): Promise { // Try direct fetch only if proxy fails log('[getAmdCert] Attempting to fetch directly without proxy.'); + try { return await fetchAsUint8Array(url); } catch (e) { log('[getAmdCert] Direct fetch also failed:', e); throw e; // Re-throw to signal that both methods failed } - - const arrayBuffer = await response.arrayBuffer(); - return new Uint8Array(arrayBuffer); } /**