Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'ssl_cert_reqs' #371

Closed
Azelphur opened this issue Sep 21, 2023 · 2 comments

Comments

@Azelphur
Copy link

Azelphur commented Sep 21, 2023

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],
            },
        },
    }
@carltongibson
Copy link
Member

What is REDIS_URL? Unless you're using rediss:// you shouldn't pass the SSL kwargs.

@DenizKucukozturk
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants