Skip to content

Possible Websocket Error or is it Me? #2170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zerxdapro opened this issue Apr 2, 2025 · 1 comment
Open

Possible Websocket Error or is it Me? #2170

zerxdapro opened this issue Apr 2, 2025 · 1 comment

Comments

@zerxdapro
Copy link

Unsure how to fix it, is it within nodriver or something on my end?

Part of my code:

async def sign():
    browser_args.append(f"--headless=new")
    browser = await uc.start(browser_args=browser_args)
    main_tab = await browser.get("draft:,")    
    try:
        finish = await tab.find("Get Started", best_match=True)
        if finish:
            return email 

    except Exception as e:
        print(f"Error: {e}")
        return None
    finally:
        browser.stop()

    return None


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.set_exception_handler(exception_handler)

    try:
        asyncio.run(sign())
    except Exception as e:
        print(f"Unhandled exception: {e}")

Error:
Task exception was never retrieved future: <Task finished name='Task-3981' coro=<Connection.aclose() done, defined at C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\nodriver\core\connection.py:305> exception=ConnectionClosedError(None, Close(code=<CloseCode.NORMAL_CLOSURE: 1000>, reason=''), None)> Traceback (most recent call last): File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\nodriver\core\connection.py", line 313, in aclose await self.websocket.close() File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\protocol.py", line 763, in close await self.write_close_frame(Close(code, reason)) File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\protocol.py", line 1224, in write_close_frame await self.write_frame(True, OP_CLOSE, data, _state=State.CLOSING) File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\protocol.py", line 1199, in write_frame await self.drain() File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\protocol.py", line 1188, in drain await self.ensure_open() File "C:\Users\justv\AppData\Local\Programs\Python\Python310\lib\site-packages\websockets\legacy\protocol.py", line 929, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received

More Info:
I have my code in a loop, it usually randomly pops up in the beginning of a new loop run. So if I ran the code 5 times, it'll happen randomly on one or more of the runs in the beginning.

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

No branches or pull requests

2 participants
@zerxdapro and others