Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Log on all non-200 responses from upstream

Manav Rathi544a1df21b4d
diff --git a/infra/workers/cast-albums/src/index.ts b/infra/workers/cast-albums/src/index.ts
index 6759126c17..d6b960cad3 100644
--- a/infra/workers/cast-albums/src/index.ts
+++ b/infra/workers/cast-albums/src/index.ts
@@ -63,6 +63,9 @@ const handleGET = async (request: Request) => {
let response = await fetch(
`https://api.ente.io/cast/files${pathname}${fileID}?${params.toString()}`
);
+
+ if (!response.ok) console.log("Upstream error", response.status);
+
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");
return response;
diff --git a/infra/workers/files/src/index.ts b/infra/workers/files/src/index.ts
index a2621941ca..2bd9e2feff 100644
--- a/infra/workers/files/src/index.ts
+++ b/infra/workers/files/src/index.ts
@@ -93,6 +93,9 @@ const handleGET = async (request: Request) => {
},
}
);
+
+ if (!response.ok) console.log("Upstream error", response.status);
+
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");
return response;
diff --git a/infra/workers/public-albums/src/index.ts b/infra/workers/public-albums/src/index.ts
index 228d09fca3..7964da4b0a 100644
--- a/infra/workers/public-albums/src/index.ts
+++ b/infra/workers/public-albums/src/index.ts
@@ -92,6 +92,9 @@ const handleGET = async (request: Request) => {
let response = await fetch(
`https://api.ente.io/public-collection/files${pathname}${fileID}?${params.toString()}`
);
+
+ if (!response.ok) console.log("Upstream error", response.status);
+
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");
return response;
diff --git a/infra/workers/thumbnails/src/index.ts b/infra/workers/thumbnails/src/index.ts
index 127fa3487d..515f6255b1 100644
--- a/infra/workers/thumbnails/src/index.ts
+++ b/infra/workers/thumbnails/src/index.ts
@@ -81,6 +81,9 @@ const handleGET = async (request: Request) => {
let response = await fetch(
`https://api.ente.io/files/preview/${fileID}?${params.toString()}`
);
+
+ if (!response.ok) console.log("Upstream error", response.status);
+
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");
return response;
diff --git a/infra/workers/uploader/src/index.ts b/infra/workers/uploader/src/index.ts
index 27f701c2a7..9214958fdb 100644
--- a/infra/workers/uploader/src/index.ts
+++ b/infra/workers/uploader/src/index.ts
@@ -110,7 +110,7 @@ const handlePOSTOrPUT = async (request: Request) => {
return new Response(null, { status: 404 });
}
- if (!response.ok) console.log("Request failed", response.status);
+ if (!response.ok) console.log("Upstream error", response.status);
response = new Response(response.body, response);
response.headers.set("Access-Control-Allow-Origin", "*");