Django Channels Example issues
See original GitHub issue- Python version: 3.6
- Operating System: OSX Sierra
Description
When testing the Django Channels examples, I went through some errors:
1: graphql_ws/django_channels.py
file is not on the latest package version. But I downloaded it manually inside the package.
2: I was getting the error "Subscriptions are not allowed. You will need to either use the subscribe function or pass allow_subscriptions=True"
. And, since the GraphQLView
object does not support the allow_subscriptions
parameter, I changed it inside the package to True
(just for testing).
3. After that, I was getting the error Subscription must return Async Iterable or Observable
. Reading this issue, I decided to add 'MIDDLEWARE: []
into the GRAPHENE
settings variable.
4. After that, I started receiving this error: 'AnonymousObservable' object has no attribute 'errors'
. Then I got a little bit frustrated and stop trying 😅
Does anyone have a clue why this is happening?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:16 (3 by maintainers)
just discovered graphene and though of evaluating state of graphql integration with django. this might a bit late though:
For short:
Subscriptions are not allowed. You will need to either use the subscribe function or pass allow_subscriptions=True
after navigating the call stack I found we can pass a custom backend to GraphQLView that can custom exc_context parameters.MIDDLEWARE: []
inGRAPHENE
settings. as OP.execution_result
from the Observable. (this is hacky) Using ExtraGraphQLView, AuthenticatedGraphQLView outlined in https://github.com/eamigo86/graphene-django-subscriptions/issues/2 didn’t work for me as they just as GraphQLView don’t handle observables returned fromexecute_graphql_request
which is from graphql/execution/executor.py#L265So in urls.py it can be:
I have not used django channels and just tried reproducing the most possible minimal example so that subscription can be resolved:
also please make sure you are using rxpy 1.6.*
Hello there,
I am trying to call a subscription from PostMan, but whenever run got is error
{ "errors": [ { "message": "Subscription must return Async Iterable or Observable. Received: <Promise at 0x2940d9c7cd0 rejected with AttributeError(\"'NoneType' object has no attribute 'register_subscription'\")>" } ], "data": null }
even when I did the same step as @ambientlight did. I can’t find any solution for that any help please!