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(js-sdk/crawl,batch-scrape): retry status call if it returns an error up to 3 times (#1343)
Gergő Móriczca93ba6c6d87
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.jsonindex 32fa0b41b..07fdf64c1 100644--- a/apps/js-sdk/firecrawl/package.json+++ b/apps/js-sdk/firecrawl/package.json@@ -1,6 +1,6 @@{"name": "@mendable/firecrawl-js",- "version": "1.19.1",+ "version": "1.19.2","description": "JavaScript SDK for Firecrawl API","main": "dist/index.js","types": "dist/index.d.ts",diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.tsindex ab09432e5..3175615dd 100644--- a/apps/js-sdk/firecrawl/src/index.ts+++ b/apps/js-sdk/firecrawl/src/index.ts@@ -1332,12 +1332,14 @@ export default class FirecrawlApp {checkInterval: number): Promise<CrawlStatusResponse | ErrorResponse> {try {+ let failedTries = 0;while (true) {let statusResponse: AxiosResponse = await this.getRequest(`${this.apiUrl}/v1/crawl/${id}`,headers);if (statusResponse.status === 200) {+ failedTries = 0;let statusData = statusResponse.data;if (statusData.status === "completed") {if ("data" in statusData) {@@ -1369,7 +1371,10 @@ export default class FirecrawlApp {);}} else {- this.handleError(statusResponse, "check crawl status");+ failedTries++;+ if (failedTries >= 3) {+ this.handleError(statusResponse, "check crawl status");+ }}}} catch (error: any) {