channels_redis
channels_redis copied to clipboard
Deprecation warning for valid_group_name method. AttributeError: 'RedisChannelLayer' object has no attribute 'valid_channel_name'.
Problem started occurring with channels==4.2.1
File "/code/dealer/daemon/handlers/player_channel_handler.py", line 21, in send_to_channel
async_to_sync(layer.send)(channel_dest, new_message)
File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 254, in __call__
return call_result.result()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 331, in main_wrap
result = await self.awaitable(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/channels_redis/core.py", line 172, in send
assert self.valid_channel_name(channel), "Channel name not valid"
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'RedisChannelLayer' object has no attribute 'valid_channel_name'. Did you mean: 'valid_channel_names'?
The specific line in channels_redis/core.py line 172 references an missing method
This logic isn't invoked using channels==4.2.0 but got uncovered with channels==4.2.1
Thanks for filing this - it brought down our production system!!
Thanks for the report.
Follows from: https://github.com/django/channels/pull/2122
Valid channels/group name methods will need updating to use the new require prefix.
OK, so started a draft in #410.
Channels 4.2.2 adds (deprecated) fallbacks for the old methods, so we can resolve this without rushing.
https://pypi.org/project/channels/4.2.2/