question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example not working [similar to #177]

See original GitHub issue

Using Ariadne==0.5.0 and Uvicorn==0.8.3, following the example on https://ariadnegraphql.org/docs/django-integration, where it is in a list called http_routes, and used in a ProtocalTypeRouter:

http_routes = []
http_routes.append(path("graphql/", GraphQL(schema, debug=True)))

router = ProtocolTypeRouter({
    "http": URLRouter(http_routes),
    "channel": ChannelNameRouter({
        "channelone": ChannelOneConsumer
    })
})

When Apollo-Federation calls this endpoint, I get:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 368, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.7/site-packages/uvicorn/middleware/asgi2.py", line 6, in __call__
    instance = self.app(scope)
  File "/usr/local/lib/python3.7/site-packages/channels/routing.py", line 58, in __call__
    return self.application_mapping[scope["type"]](scope)
  File "/usr/local/lib/python3.7/site-packages/channels/routing.py", line 144, in __call__
    "kwargs": {**outer.get("kwargs", {}), **kwargs},
TypeError: __call__() missing 2 required positional arguments: 'receive' and 'send'
[2019-07-04 11:54:07 +0800] [497] [INFO] ('172.21.0.3', 50320) - "POST /graphql/ HTTP/1.0" 500

The comment https://github.com/mirumee/ariadne/issues/177#issuecomment-493950544 says that Ariadne should be using ASGI3, but uvicorn still shows to be using ASGI2? (uvicorn/middleware/asgi2.py). Btw I am using channels==2.2.0 What should I do to get around this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
patryscommented, Jul 4, 2019

I think you may be confusing two separate integrations, one for Django and one for Django Channels. You should only use one of them. Django Channels integration is currently broken as we’re waiting for an ASGI3 version of Channels.

Here’s a workaround ASGI2 compatibility class that you can use instead of ariadne.asgi.GraphQL if you want to use it:

from ariadne.asgi import GraphQL

class DjangoChannelsGraphQL(GraphQL):
    def __call__(self, scope) -> None:
        async def handle(receive, send):
            await super(DjangoChannelsGraphQL, self).__call__(scope, receive, send)
        return handle
0reactions
rafalpcommented, Sep 13, 2019

Closing this as answered. If there are any other questions, feel free to ask!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Synonyms of stated - Merriam-Webster Thesaurus
to convey in appropriate or telling terms please state the vehicle's mechanical problem as clearly and briefly as possible. Synonyms & Similar Words....
Read more >
10.4 - Multicollinearity | STAT 462
Multicollinearity exists when two or more of the predictors in a regression model are moderately or highly correlated with one another.
Read more >
Error bars in experimental biology - PMC - NCBI
Error bars commonly appear in figures in publications, but experimental biologists are often unsure how they should be used and interpreted.
Read more >
More Is Different - TKM (KIT)
4 August 1972, Volume 177, Number 4047 less relevance they seem to have to the very real problems of the rest of sci-....
Read more >
Table 2 Fallacy: Presenting and Interpreting Confounder and ...
An example. A recent article (11) illustrates the issues we raise above. Page 1,359 shows a Table 2 with the main exposure (work-related...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found