Skip to content

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

fix(scrapeURL/fire-engine): handle "Operation timed out" error correctly

Gergő Móricz52e3313bfbcf
diff --git a/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts b/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts
index 65459bc02..4a6002512 100644
--- a/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts
+++ b/apps/api/src/scraper/scrapeURL/engines/fire-engine/index.ts
@@ -139,12 +139,12 @@ async function performFireEngineScrape<
);
throw error;
} else {
- Sentry.captureException(error);
errors.push(error);
logger.debug(
`An unexpeceted error occurred while calling checkStatus. Error counter is now at ${errors.length}.`,
{ error, jobId: scrape.jobId },
);
+ Sentry.captureException(error);
}
}
diff --git a/apps/api/src/scraper/scrapeURL/lib/fetch.ts b/apps/api/src/scraper/scrapeURL/lib/fetch.ts
index 4d23c77a8..84e18db7e 100644
--- a/apps/api/src/scraper/scrapeURL/lib/fetch.ts
+++ b/apps/api/src/scraper/scrapeURL/lib/fetch.ts
@@ -125,7 +125,7 @@ export async function robustFetch<
: {}),
});
} catch (error) {
- if (error instanceof TimeoutSignal || (error instanceof Error && error.name === "TimeoutError")) {
+ if (error instanceof TimeoutSignal || (error instanceof Error && error.name === "TimeoutError") || (error instanceof Error && error.message === "Operation timed out")) {
throw new TimeoutSignal();
} else if (!ignoreFailure) {
Sentry.captureException(error);