From a7894a27145c4c1e8981ffce0b6ea6726009881f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Fri, 23 May 2025 16:29:28 +0200 Subject: [PATCH] fix(scrapeURL/pdf): even better timeout detection --- apps/api/src/scraper/scrapeURL/engines/pdf/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts index 61085592..a7397042 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(