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(v1/scrape): add total wait specified in request to timeout
Gergő Móriczf00c0b82f9be
diff --git a/apps/api/src/controllers/v1/scrape.ts b/apps/api/src/controllers/v1/scrape.tsindex f0744c22b..ebbabc00f 100644--- a/apps/api/src/controllers/v1/scrape.ts+++ b/apps/api/src/controllers/v1/scrape.ts@@ -54,9 +54,11 @@ export async function scrapeController(jobPriority);+ const totalWait = (req.body.waitFor ?? 0) + (req.body.actions ?? []).reduce((a,x) => (x.type === "wait" ? x.milliseconds : 0) + a, 0);+let doc: any | undefined;try {- doc = (await waitForJob(job.id, timeout))[0];+ doc = (await waitForJob(job.id, timeout + totalWait))[0];} catch (e) {Logger.error(`Error in scrapeController: ${e}`);if (e instanceof Error && e.message.startsWith("Job wait")) {