Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix: force cache miss for stale screenshot signed URLs (#3398)

Rafael Millere495b3af7e30
diff --git a/apps/api/src/services/index.ts b/apps/api/src/services/index.ts
index ae71536b7..5f377f09c 100644
--- a/apps/api/src/services/index.ts
+++ b/apps/api/src/services/index.ts
@@ -97,6 +97,19 @@ export async function getIndexFromGCS(
) *
1000;
}
+ // TODO: remove on Apr 26 -- Approximate signing time: expiresAt minus the 7-day TTL used when signing.
+ // Cache entries signed before this cutoff are treated as stale.
+ const SCREENSHOT_CACHE_VALID_AFTER = new Date(
+ "2026-04-19T21:00:00Z",
+ ).getTime();
+ const signedAt = expiresAt - 1000 * 60 * 60 * 24 * 7;
+ if (
+ screenshotUrl.hostname === "storage.googleapis.com" &&
+ signedAt < SCREENSHOT_CACHE_VALID_AFTER
+ ) {
+ logger?.info("Stale screenshot cache, forcing miss");
+ return null;
+ }
if (
screenshotUrl.hostname === "storage.googleapis.com" &&
expiresAt < Date.now()