stefanw / channels-yroom

Django Channels WebSocket consumer and worker for synchronizing Yjs clients
https://channels-yroom.readthedocs.io/en/latest/
MIT License
15 stars 5 forks source link

The default name room is not being used #5

Closed linspw closed 1 year ago

linspw commented 1 year ago

Seems like a pretty simple setup to me. 😄 This error appears in the new version, and I confirmed it with commits and debbug

Error:

root@947fc0db06e9:/application# python manage.py yroom
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/logging/__init__.py", line 1110, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 687, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/logging/__init__.py", line 377, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
  File "/application/manage.py", line 22, in <module>
    main()
  File "/application/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.11/site-packages/channels_yroom/management/commands/yroom.py", line 50, in handle
    logger.info("Running worker for channel '{}'", channel)
Message: "Running worker for channel '{}'"
Arguments: (None,)
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<YroomWorker.run_worker() done, defined at /usr/local/lib/python3.11/site-packages/channels_yroom/worker.py:44> exception=TypeError('Channel name must be a valid unicode string with length < 100 containing only ASCII alphanumerics, hyphens, underscores, or periods, not None')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/channels_yroom/worker.py", line 58, in run_worker
    message = await self.channel_layer.receive(self.channel)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/channels_redis/core.py", line 266, in receive
    assert self.valid_channel_name(channel)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/channels/layers.py", line 160, in valid_channel_name
    raise TypeError(self.invalid_name_error.format("Channel", name))
TypeError: Channel name must be a valid unicode string with length < 100 containing only ASCII alphanumerics, hyphens, underscores, or periods, not None

Debug:

Gravação de tela de 04-05-2023 09:15:55.webm

OBS: I tried to use the command with the --channel configuration but it gave parsing error image

stefanw commented 1 year ago

Thanks. Should be fixed in v0.0.4 with increased test coverage.