Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Bugfix of Apify.call() - getRun() might return null

Jan Curn5e3ff31b2d22
diff --git a/src/actor.js b/src/actor.js
index 3da68a568..d6fd68694 100644
--- a/src/actor.js
+++ b/src/actor.js
@@ -656,6 +656,8 @@ export const call = (actId, input, opts = {}, callback) => {
return acts
.getRun(Object.assign({}, defaultOpts, { waitForFinish, runId: run.id }))
.then((updatedRun) => {
+ // Note that it might take some time for db replicas to get up-to-date, so getRun() might return null
+ if (!updatedRun) return waitForRunToFinish(run);
if (!_.contains(ACT_TASK_TERMINAL_STATUSES, updatedRun.status)) return waitForRunToFinish(updatedRun);
if (!fetchOutput) return updatedRun;