Skip to content

Commit

Permalink
chore: update log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansonhkg committed Apr 15, 2024
1 parent f8d57dc commit 2de96b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/crypto/src/lib/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ async function getAmdCert(url: string): Promise<Uint8Array> {
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) {
Expand All @@ -397,15 +397,13 @@ async function getAmdCert(url: string): Promise<Uint8Array> {

// 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);
}

/**
Expand Down

0 comments on commit 2de96b9

Please sign in to comment.