ERROR Error in websocket connection Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 1301, in close_connection await self.transfer_data_task File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 974, in transfer_data await asyncio.shield(self._put_message_waiter) asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/apify/event_manager.py", line 222, in _process_platform_messages async for message in websocket: File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 498, in __aiter__ yield await self.recv() ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 568, in recv await self.ensure_open() File "/usr/local/lib/python3.11/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received
async with Actor: actor_input = await Actor.get_input() or {} proxy_settings = actor_input.get('proxies',None) proxy_configuration = await Actor.create_proxy_configuration(actor_proxy_input=proxy_settings) proxy = await proxy_configuration.new_proxy_info('session0') # Launch Playwright an open a new browser context Actor.log.info('Launching Playwright...') async with async_playwright() as playwright: server = proxy['url'][proxy['url'].find('@')+1:] print("Determined server is %s" % (server)) proxy_block = { "server": server, "username": proxy['username'], "password": proxy['password'] } browser = await playwright.chromium.launch(headless=Actor.config.headless, proxy=proxy_block) context = await browser.new_context() tasks = [] task = asyncio.create_task(worker('worker-0', context)) tasks.append(task) # Wait until all worker tasks finish or one throws an exception try: await asyncio.gather(*tasks) except Exception as e: raise e print("All done ")
apify/event_manager.py
we think it's some Apify global code that's running, but we can't find it.async_playwright
and worker
?) Is it happening both locally and on the platform?tasks = [] task = asyncio.create_task(worker('worker-0', context)) tasks.append(task)
await browser.close()
from playwright.async_api import async_playwright
is that. context = await browser.new_context(proxy=[we give it a new proxy]) page = await context.new_page() await page.goto(url) content = await page.content() # do stuff with content
_process_platform_messages
is supposed to run and why it would time out ?