Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix: improve FirePDF error logging (#3319)
Abimael Martell87d41746bb57
diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/firePDF.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/firePDF.tsindex 6cbd92be4..4f72a9d80 100644--- a/apps/api/src/scraper/scrapeURL/engines/pdf/firePDF.ts+++ b/apps/api/src/scraper/scrapeURL/engines/pdf/firePDF.ts@@ -15,19 +15,19 @@ export async function scrapePDFWithFirePDF(maxPages?: number,pagesProcessed?: number,): Promise<PDFProcessorResult> {- const logger = meta.logger.child({ method: "scrapePDF/firePDF" });+ const logger = meta.logger;if (!maxPages && !meta.internalOptions.zeroDataRetention) {try {const cached = await getPdfResultFromCache(base64Content, "firepdf");if (cached) {- logger.info("Using cached Fire PDF result", {+ logger.info("Using cached FirePDF result", {scrapeId: meta.id,});return cached;}} catch (error) {- logger.warn("Error checking Fire PDF cache, proceeding", { error });+ logger.warn("Error checking FirePDF cache, proceeding", { error });}}@@ -35,7 +35,7 @@ export async function scrapePDFWithFirePDF(const startedAt = Date.now();- logger.info("Fire PDF started", {+ logger.info("FirePDF started", {scrapeId: meta.id,url: meta.rewrittenUrl ?? meta.url,maxPages,@@ -66,7 +66,7 @@ export async function scrapePDFWithFirePDF(const durationMs = Date.now() - startedAt;const pages = resp.pages_processed ?? pagesProcessed;- logger.info("Fire PDF completed", {+ logger.info("FirePDF completed", {scrapeId: meta.id,url: meta.rewrittenUrl ?? meta.url,durationMs,@@ -85,7 +85,7 @@ export async function scrapePDFWithFirePDF(try {await savePdfResultToCache(base64Content, processorResult, "firepdf");} catch (error) {- logger.warn("Error saving Fire PDF result to cache", { error });+ logger.warn("Error saving FirePDF result to cache", { error });}}diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.tsindex d52cffe96..679e24389 100644--- a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts+++ b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts@@ -373,9 +373,14 @@ export async function scrapePDF(meta: Meta): Promise<EngineScrapeResult> {throw error;}if (forceFirePDF) {+ meta.logger.error("FirePDF failed (forced, no fallback)", {+ method: "scrapePDF/firePDF",+ error,+ });throw error;}- meta.logger.warn("Fire PDF failed -- falling back to MinerU", {+ meta.logger.warn("FirePDF failed -- falling back to MinerU", {+ method: "scrapePDF/firePDF",error,});}