diff --git a/src/main.test.ts b/src/main.test.ts index 350f858..fdb93cf 100644 --- a/src/main.test.ts +++ b/src/main.test.ts @@ -20,6 +20,7 @@ beforeAll(async () => { globalThis.Request = nodeFetch.Request // @ts-expect-error Expected type mismatch between native implementation and node-fetch globalThis.Response = nodeFetch.Response + // @ts-expect-error Expected type mismatch between native implementation and node-fetch globalThis.Headers = nodeFetch.Headers } }) diff --git a/src/main.ts b/src/main.ts index cbcb5c7..e7481c5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -158,7 +158,10 @@ export class Blobs { const res = await fetchAndRetry(this.fetcher, url, options) - if (res.status === 404 && method === HTTPMethod.Get) { + // Temp fix for: + // Cloudfront currently returns a 403 if it cannot find the artefact instead of returning a 404 + // Workaround for: https://github.com/netlify/pod-dev-foundations/issues/592 + if ((res.status === 403 || res.status === 404) && method === HTTPMethod.Get) { return null }