TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'ssl_cert_reqs'
Azelphur opened this issue · comments
Alfie Day commented
The example given in the README https://github.com/django/channels_redis#hosts appears to no longer work.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/staticfiles/handlers.py", line 101, in __call__
return await self.application(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/routing.py", line 62, in __call__
return await application(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/security/websocket.py", line 37, in __call__
return await self.application(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/apps/channels/middlewares.py", line 28, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/routing.py", line 116, in __call__
return await application(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/consumer.py", line 94, in app
return await consumer(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/consumer.py", line 46, in __call__
self.channel_name = await self.channel_layer.new_channel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels_redis/pubsub.py", line 18, in _async_proxy
return await getattr(layer, name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels_redis/pubsub.py", line 145, in new_channel
await self._subscribe_to_channel(channel)
File "/usr/local/lib/python3.11/site-packages/channels_redis/pubsub.py", line 124, in _subscribe_to_channel
await shard.subscribe(channel)
File "/usr/local/lib/python3.11/site-packages/channels_redis/pubsub.py", line 264, in subscribe
await self._pubsub.subscribe(channel)
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/client.py", line 929, in subscribe
ret_val = await self.execute_command("SUBSCRIBE", *new_channels.keys())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/client.py", line 782, in execute_command
await self.connect()
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/client.py", line 792, in connect
self.connection = await self.connection_pool.get_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/connection.py", line 1100, in get_connection
connection = self.make_connection()
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/connection.py", line 1140, in make_connection
return self.connection_class(**self.connection_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/asyncio/connection.py", line 635, in __init__
super().__init__(**kwargs)
TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'ssl_cert_reqs'
My CHANNEL_LAYERS setting, for reference:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.pubsub.RedisPubSubChannelLayer",
"CONFIG": {
"hosts": [
{
"address": REDIS_URL,
"ssl_cert_reqs": None,
}
],
},
"TEST_CONFIG": {
"expiry": 100500,
"hosts": [REDIS_URL],
},
},
}
Carlton Gibson commented
What is REDIS_URL? Unless you're using rediss://
you shouldn't pass the SSL kwargs.
Deniz Küçüköztürk commented
I was trying to add "ssl_cert_reqs": None,
in my local and it was throwing this error. Now I am only adding it in deployed environments and it is working. Thanks a lot!