DjangoChannelsGraphqlWs
DjangoChannelsGraphqlWs copied to clipboard
Asgiref 3.3.2 breaks the consumer on Python < 3.8
Asgiref release 3.3.2 added type checks for functions passed to async_to_sync/sync_to_async.. Due to this, the _on_gql_start method raises exception here
As per https://stackoverflow.com/a/52422903 - the bug appears on Python 3.7 and older.
Stack trace:
channels_graphql_ws.graphql_ws_consumer ERROR GraphQL query processing error: Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/channels_graphql_ws/graphql_ws_consumer.py", line 560, in _on_gql_start
functools.partial(self._register_subscription, operation_id)
File "/usr/local/lib/python3.7/site-packages/asgiref/sync.py", line 105, in __init__
raise TypeError("async_to_sync can only be applied to async functions.")
TypeError: async_to_sync can only be applied to async functions.
Python version: 3.7 django-channels-graphql-ws version: 0.7.5 asgiref version: 3.3.2