When trying to run the first subscription example from the Documentation the following error occurs as soon as the subscription is sent from GraphiQL:
Running strawberry on http://0.0.0.0:8000/graphql 🍓
[2023-04-30 17:58:55]: No operation name
subscription {
count(target: 5)
}
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/user/Library/Python/3.9/lib/python/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 254, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/middleware/errors.py", line 149, in __call__
await self.app(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/middleware/cors.py", line 76, in __call__
await self.app(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/starlette/routing.py", line 341, in handle
await self.app(scope, receive, send)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/asgi/__init__.py", line 118, in __call__
await self.graphql_transport_ws_handler_class(
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py", line 78, in handle
return await self.handle_request()
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/asgi/handlers/graphql_transport_ws_handler.py", line 58, in handle_request
await self.handle_message(message)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py", line 125, in handle_message
await handler(handler_arg)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py", line 181, in handle_subscribe
context = await self.get_context()
File "/Users/user/Library/Python/3.9/lib/python/site-packages/strawberry/asgi/handlers/graphql_transport_ws_handler.py", line 36, in get_context
return await self._get_context(request=self._ws)
TypeError: get_context() missing 1 required positional argument: 'response'
ERROR: closing handshake failed
Traceback (most recent call last):
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/server.py", line 248, in handler
await self.close()
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/protocol.py", line 766, in close
await self.write_close_frame(Close(code, reason))
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/protocol.py", line 1232, in write_close_frame
await self.write_frame(True, OP_CLOSE, data, _state=State.CLOSING)
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/protocol.py", line 1205, in write_frame
await self.drain()
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/protocol.py", line 1194, in drain
await self.ensure_open()
File "/Users/user/Library/Python/3.9/lib/python/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received
System Information
Operating system: macOS 13.2 (MacBook Pro M2 Chip - ARM64)
Strawberry version (if applicable): 0.175.0, also tested: 0.173.1
Additional Context
Start command: python3 -m strawberry server app
Python version: 3.9.0
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
Describe the Bug
When trying to run the first subscription example from the Documentation the following error occurs as soon as the subscription is sent from GraphiQL:
System Information
macOS 13.2 (MacBook Pro M2 Chip - ARM64)
0.175.0
, also tested:0.173.1
Additional Context
python3 -m strawberry server app
3.9.0
Upvote & Fund