Playwright issues

aysan0
PRO

3 months ago

I get an error like the following:
playwright._impl._errors.TargetClosedError: BrowserType.launch: Target page, context or browser has been closed

Interestingly, I can actually see a single scrape work before I get this error. Trying to understand what is causing it. A key dependency on a new feature we are releasing.

Awaiting User Response

4 Replies

aysan0
PRO

3 months ago

Interesting nuance. the first browser succeeds. I use it in context like

async with AsyncWebCrawler() as crawler:
some code ## This succeeds

...some other code...

async with AsyncwebCrawler() as crawler:
some crawling code ## This fails.

I verified that the first browser launch always succeeds.


chandrika
EMPLOYEE

3 months ago

Hey there, this seems like an application level issue but from looking around for this error it might have to do with making sure that the browser context is properly closed after each use or checking for any unhandled promises that might be causing the browser to close unexpectedly. You could also review the AsyncWebCrawler for resource management issues


Status changed to Awaiting User Response railway[bot] 3 months ago


aysan0
PRO

3 months ago

Interesting. I can see that the issue does not repro locally and that browser sessions are properly closed.


Status changed to Awaiting Railway Response railway[bot] 3 months ago


chandrika
EMPLOYEE

3 months ago

Apologies but this looks like an issue with the application level code, we can offer help on platform level issues here but as this thread is public, the community might be able to help


Status changed to Awaiting User Response railway[bot] 3 months ago


Playwright issues - Railway Help Station