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 in BasicCrawler: native Promise doesn't have finally() function

Jan Curnd332ab96105c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9020ca911..9ee59e574 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,6 @@
-0.5.41 / 2018-07-04
+0.5.42 / 2018-07-04
===================
-- Dummy version bump to get new commit ID
-
-0.5.40 / 2018-07-04
-===================
-- Bugfix: native Promise doesn't have finally() function
+- Bugfix in BasicCrawler: native Promise doesn't have finally() function
0.5.39 / 2018-06-25
===================
diff --git a/package.json b/package.json
index 71a77928f..dff4f0c5b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "apify",
- "version": "0.5.41",
+ "version": "0.5.42",
"description": "Web scraping and automation SDK",
"main": "build/index.js",
"keywords": [
diff --git a/src/basic_crawler.js b/src/basic_crawler.js
index d10f0cf17..aaef02c83 100644
--- a/src/basic_crawler.js
+++ b/src/basic_crawler.js
@@ -224,7 +224,9 @@ export default class BasicCrawler {
const handlePromise = this.handleRequestFunction({ request });
if (!isPromise(handlePromise)) throw new Error('User provided handleRequestFunction must return a Promise.');
- return handlePromise
+ // NOTE: handlePromise might not be bluebird promise
+ return Promise.resolve()
+ .then(() => handlePromise)
.then(() => source.markRequestHandled(request))
.catch((error) => {
if (request.ignoreErrors) {