popular-magentaP
Apify & Crawlee3y ago
4 replies
popular-magenta

Playwright Crawler fails on undefined page

Hello there! I just build my first actor using the apify cli. I chose to use a typescript playwright crawler. It by default uses the createPlaywrightRouter() function to create a router and pass it to the requestHandler of the PlaywrightCrawler.

All seems well, and according to typescript, I should be able to access a page object in the handler. (I'm only using the addDefaultHandler) However, when I run the actor on the Apify platform it fails with the following exception:

2023-02-09T15:16:45.925Z INFO  PlaywrightCrawler: Start of default handler 
2023-02-09T15:16:45.932Z WARN  PlaywrightCrawler: Reclaiming failed request back to the list or queue. page.evaluate: ReferenceError: page is not defined
2023-02-09T15:16:45.934Z     at eval (eval at evaluate (:197:30), <anonymous>:5:13)
2023-02-09T15:16:45.936Z     at UtilityScript.evaluate (<anonymous>:199:17)
2023-02-09T15:16:45.939Z     at UtilityScript.<anonymous> (<anonymous>:1:44)


So it seems page is not defined. I can't seem to find anything in the docs about this. Am I missing something during initialisation?
Any help would be greatly appreciated!
Was this page helpful?