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.

fix: do not hide stack trace of (retried) Type/Syntax/ReferenceErrors

Martin Adámek469b4b58f1c1
diff --git a/packages/basic-crawler/src/internals/basic-crawler.ts b/packages/basic-crawler/src/internals/basic-crawler.ts
index d5ea529e7..a78027710 100644
--- a/packages/basic-crawler/src/internals/basic-crawler.ts
+++ b/packages/basic-crawler/src/internals/basic-crawler.ts
@@ -1043,6 +1043,10 @@ export class BasicCrawler<Context extends CrawlingContext = BasicCrawlingContext
* @returns The message to be logged
*/
protected _getMessageFromError(error: Error, forceStack = false) {
+ if ([TypeError, SyntaxError, ReferenceError].some((type) => error instanceof type)) {
+ forceStack = true;
+ }
+
// For timeout errors we want to show the stack just in case the env variable is set
if (error instanceof TimeoutError) {
return process.env.CRAWLEE_VERBOSE_LOG ? error.stack : error.message || error;