TypeError: An asyncio.Future, a coroutine or an awaitable is required
See original GitHub issueRequirements
- Python 3.8
- asgiref 3.2.0
- channels 2.4.0
- channels-redis 2.4.2
- Django 3.0.9,
- gunicorn 20.1.0
- redis 3.5.3
- uvicorn 0.11.5
- websockets 8.1
I run channels as gunicorn -w 5 -b 0.0.0.0:8000 --log-level debug -k uvicorn.workers.UvicornWorker config.asgi:application
.
Also I have nginx
as proxy-server.
Logs
class TokenAuthMiddleware:
def __init__(self, inner):
self.inner = inner
def __call__(self, scope):
return TokenAuthMiddlewareInstance(scope, self)
class TokenAuthMiddlewareInstance:
def __init__(self, scope, middleware):
self.middleware = middleware
self.scope = dict(scope)
self.inner = self.middleware.inner
async def __call__(self, receive, send):
try:
token_key = (dict((x.split("=") for x in self.scope["query_string"].decode().split("&")))).get(
"token", None
)
except ValueError:
token_key = None
if token_key is None:
self.scope["user"] = AnonymousUser()
else:
token_data = await get_token_data(token_key)
self.scope["user"] = await get_user(token_data["user_id"])
inner = self.inner(self.scope)
return await inner(receive, send)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
TypeError: An asyncio.Future, a coroutine or an awaitable is ...
I'm trying to make an asynchronous web scraper using beautifulsoup and aiohttp.This is my initial code to start things.I'm getting a [TypeError: ......
Read more >nest_asyncio error: TypeError: An asyncio.Future, a coroutine ...
I am getting the a persistent error when loading a class through spyder console. Loading the same class on my windows os does...
Read more >An asyncio.Future, a coroutine or an awaitable is required in ...
display(df). I get the following error: TypeError: An asyncio.Future, a coroutine or an awaitable is required. I launch the script in Spyder, Anaconda....
Read more >An asyncio.Future, a coroutine or an awaitable is required
I'm trying to make an asynchronous web scraper using beautifulsoup and aiohttp.This is my initial code to start things.I'm getting a [TypeError: An...
Read more >Common Mistakes Using Python3 asyncio
1. Introduction · 2. RuntimeWarning: coroutine foo was never awaited · 3. Task was destroyed but it is pending! · 4. Task/Future is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try this out. It made like AuthMiddleware from same commit.
@YegorDB But I use channels v2.4.0) https://github.com/django/channels/blob/56bb2b9afc9207d19a66d78f39a8e337cde93551/channels/middleware.py#L21