This has caused me half a day of head scratching.
The default subscription query, as provided by the explorer in GraphiQL will create something like
subscription MySubscription {
__typename
count
}
When executed, it results in the server repeatedly failing.
[2022-01-26 18:07:51]: No operation name
subscription MySubscription {
__typename
count
}
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 190, in run_asgi
result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\middleware\errors.py", line 146, in __call__
await self.app(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\middleware\cors.py", line 76,
in __call__
await self.app(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\exceptions.py", line 58, in __call__
await self.app(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\routing.py", line 656, in __call__
await route.handle(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\starlette\routing.py", line 315, in handle
await self.app(scope, receive, send)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\asgi\__init__.py", line 68, in __call__
await self.graphql_ws_handler_class(
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\subscriptions\protocols\graphql_ws\handlers.py", line 66, in handle
return await self.handle_request()
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\asgi\handlers\graphql_ws_handler.py", line 52, in handle_request
await self.handle_message(message)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\subscriptions\protocols\graphql_ws\handlers.py", line 79, in handle_message
await self.handle_start(message)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\subscriptions\protocols\graphql_ws\handlers.py", line 108, in handle_start
result_source = await self.schema.subscribe(
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\strawberry\schema\schema.py", line 194,
in subscribe
return await subscribe(
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\graphql\subscription\subscribe.py", line 58, in subscribe
result_or_stream = await create_source_event_stream(
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\graphql\subscription\subscribe.py", line 147, in create_source_event_stream
return await execute_subscription(context)
File "C:\Users\kristjan\AppData\Local\pypoetry\Cache\virtualenvs\graphql-test-FOqRLQSY-py3.9\lib\site-packages\graphql\subscription\subscribe.py", line 194, in execute_subscription
raise TypeError(
TypeError: Subscription field must return AsyncIterable. Received: None.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too