theblazehen opened a new issue, #9724: URL: https://github.com/apache/skywalking/issues/9724
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues. ### Apache SkyWalking Component Python Agent (apache/skywalking-python) ### What happened There is an assertion error whenever a websocket connection gets made ### What you expected to happen Either ignore websocket connections, or support tracing them ### How to reproduce Save the following as `ws_example.py`: ``` > cat ws_example.py from fastapi import FastAPI, WebSocket app = FastAPI() @app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() while True: data = await websocket.receive_text() await websocket.send_text(f"Message text was: {data}") ``` And run with `sw-python run uvicorn --port 8080 ws_example:app` Make a request with ``` > wscat -c ws://127.0.0.1:8080/ws error: Unexpected server response: 500 ``` And the logs in the python service will show you ``` ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 225, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/fastapi/applications.py", line 270, in __call__ await super().__call__(scope, receive, send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__ await self.middleware_stack(scope, receive, send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/starlette/middleware/errors.py", line 149, in __call__ await self.app(scope, receive, send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/skywalking/plugins/sw_fastapi.py", line 45, in _sw_fast_api req = Request(scope, receive=receive, send=send) File "/home/ubuntu/venv/deepalert/lib/python3.10/site-packages/starlette/requests.py", line 195, in __init__ assert scope["type"] == "http" AssertionError ``` ### Anything else _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
