Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: workaround for a cloudfront issue where it throws on a 403 #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
lukasholzer merged 1 commit into main from fix/dont-throw-on-403-status-code
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: workaround for a cloudfront issue where it throws on a 403
  • Loading branch information
Lukas Holzer committed Sep 21, 2023
commit c0fd160d49c95205b577b031e3b3aee622e003af
1 change: 1 addition & 0 deletions src/main.test.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
Expand Down
5 changes: 4 additions & 1 deletion src/main.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

AltStyle によって変換されたページ (->オリジナル) /