chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

socket.io error when using custom react as frontend and chainlit as backend on cloud, local it works

Open suman12345678 opened this issue 11 months ago • 2 comments

Describe the bug When I use custom react as frontend and chainlit as backend, sometimes the backend endpoint call from react frontend doesnot work. This works in local system. But when I deploy chainlit server as a docker in cloud, sometimes it waits.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

suman12345678 avatar Mar 10 '24 13:03 suman12345678

I get the below request when multiple sessions are opened.

ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 247, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 289, in call await super().call(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 149, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 75, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call raise e File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 443, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/engineio/async_drivers/asgi.py", line 58, in call await self.engineio_server.handle_request(scope, receive, send) File "/usr/local/lib/python3.9/site-packages/socketio/async_server.py", line 448, in handle_request return await self.eio.handle_request(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/engineio/async_server.py", line 288, in handle_request packets = await socket.handle_get_request(environ) File "/usr/local/lib/python3.9/site-packages/engineio/async_socket.py", line 89, in handle_get_request return await getattr(self, 'upgrade' + transport)(environ) File "/usr/local/lib/python3.9/site-packages/engineio/async_socket.py", line 143, in _upgrade_websocket return await ws(environ) File "/usr/local/lib/python3.9/site-packages/engineio/async_drivers/asgi.py", line 235, in call await self.handler(self) File "/usr/local/lib/python3.9/site-packages/engineio/async_socket.py", line 168, in _websocket_handler await ws.send(packet.Packet(packet.PONG, data='probe').encode()) File "/usr/local/lib/python3.9/site-packages/engineio/async_drivers/asgi.py", line 252, in send await self.asgi_send({'type': 'websocket.send', File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in sender await send(message) File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 320, in asgi_send await self.send(data) # type: ignore[arg-type] File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send await self.ensure_open() File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 948, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedOK: received 1005 (no status received [internal]); then sent 1005 (no status received [internal])

suman12345678 avatar Apr 11 '24 15:04 suman12345678

Hello @suman12345678 How did you fix the above issue? I encountered the same issue for my chainlit ui which is deployed in GCP

wxp16 avatar Jun 10 '24 18:06 wxp16