Skip to content

fix: BrowserCrawler closes ctx.page before errorHandler runs on navigation errors (#3647)#3648

Open
moaedy wants to merge 1 commit into
apify:masterfrom
moaedy:godfix/issue-3647-run-6
Open

fix: BrowserCrawler closes ctx.page before errorHandler runs on navigation errors (#3647)#3648
moaedy wants to merge 1 commit into
apify:masterfrom
moaedy:godfix/issue-3647-run-6

Conversation

@moaedy
Copy link
Copy Markdown

@moaedy moaedy commented May 12, 2026

Summary

Root cause: BrowserCrawler._handleNavigationTimeout was called on every navigation error but unconditionally closed crawlingContext.page, racing user errorHandler access and duplicating the close already performed by _cleanupContext in the finally of _runRequestFunction. Change: Moved the await crawlingContext.page.close() inside the existing TimeoutError branch of _handleNavigationTimeout in packages/browser-crawler/src/internals/browser-crawler.ts, so eager close only fires when there is a hung page to release. Closes #3647

@moaedy moaedy force-pushed the godfix/issue-3647-run-6 branch from da68c9b to d3a29d9 Compare May 12, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserCrawler closes ctx.page before errorHandler runs on navigation errors

3 participants