Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Websocket connection with uvicorn/django/nginx not working

$
0
0

I am trying to establish a websocket connection in my app but I'm getting different errors. I'm using elasticache redis cache and my settings.py looks as follows:

CHANNEL_LAYERS = { "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { "hosts": ["rediss://redis-m0rn9y.serverless.use1.cache.amazonaws.com:6379"], }, }, }

I've configured my channel_layers numerous times but this one allows me to establish a connection at least before it closes:

Feb 26 23:54:37 ip-172-31-40-162 python[9623]: INFO:     128.6.36.223:0 - "GET /app/api/get_user_inventory/ HTTP/1.0" 200 OKFeb 26 23:54:38 ip-172-31-40-162 python[9623]: INFO:     128.6.36.223:0 - "GET /app/api/check_session/ HTTP/1.0" 200 OKFeb 26 23:54:38 ip-172-31-40-162 python[9623]: Not Found: /app/inventory/styles.css.mapFeb 26 23:54:38 ip-172-31-40-162 python[9623]: Not Found: /app/inventory/styles.css.mapFeb 26 23:54:38 ip-172-31-40-162 python[9623]: INFO:     128.6.36.223:0 - "GET /app/inventory/styles.css.map HTTP/1.0" 404 Not FoundFeb 26 23:54:38 ip-172-31-40-162 python[9623]: INFO:     ('128.6.36.223', 0) - "WebSocket /ws/inventory/" [accepted]Feb 26 23:54:38 ip-172-31-40-162 python[9623]: WebSocket connected to the group 'inventory'.Feb 26 23:54:38 ip-172-31-40-162 python[9623]: INFO:     connection openFeb 26 23:54:38 ip-172-31-40-162 python[9623]: ERROR:    Exception in ASGI applicationFeb 26 23:54:38 ip-172-31-40-162 python[9623]: Traceback (most recent call last):Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 255>Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     result = await self.app(self.scope, self.asgi_receive, self.asgi_send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await self.app(scope, receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/routing.py", line 62, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await application(scope, receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/sessions.py", line 47, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await self.inner(dict(scope, cookies=cookies), receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/sessions.py", line 263, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await self.inner(wrapper.scope, receive, wrapper.send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/auth.py", line 185, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await super().__call__(scope, receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/middleware.py", line 24, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await self.inner(scope, receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/routing.py", line 116, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await application(Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/consumer.py", line 94, in appFeb 26 23:54:38 ip-172-31-40-162 python[9623]:     return await consumer(scope, receive, send)Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/consumer.py", line 58, in __call__Feb 26 23:54:38 ip-172-31-40-162 python[9623]:     await await_many_dispatch(Feb 26 23:54:38 ip-172-31-40-162 python[9623]:   File "/home/ubuntu/venv/lib/python3.10/site-packages/channels/utils.py", line 57, in await_many_dispatchFeb 26 23:54:38 ip-172-31-40-162 python[9623]:     await taskFeb 26 23:54:38 ip-172-31-40-162 python[9623]: redis.exceptions.ResponseError: Lua scripts without any input keys are not supported.Feb 26 23:54:38 ip-172-31-40-162 python[9623]: INFO:     connection closed

Any help is appreciated. Thanks.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>