Skip to content

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

fix(scrapeURL/pdf): even better timeout detection

Gergő Móricza7894a27145c
diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
index 610855920..a7397042a 100644
--- a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
+++ b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
@@ -238,7 +238,10 @@ export async function scrapePDF(
|| error instanceof TimeoutError
) {
throw error;
- } else if (error instanceof Error && error.name === "TimeoutError") {
+ } else if (
+ (error instanceof Error && error.name === "TimeoutError")
+ || (error instanceof Error && error.message === "Request failed" && error.cause && error.cause instanceof Error && error.cause.name === "TimeoutError")
+ ) {
throw new TimeoutError("PDF parsing timed out, please increase the timeout parameter in your scrape request");
}
meta.logger.warn(