Parallels/rq-dashboard

Blueprint usage as documented for v0.6.6 raises `ValueError: Unsupported redis URL scheme:`

homeworkprod opened this issue · 0 comments

Using rq-dashboard as a blueprint as described in the README, which has worked before, now fails:

Traceback (most recent call last):
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 2552, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 2532, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 1821, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/flask/app.py", line 2313, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/rq_dashboard/web.py", line 83, in push_rq_connection
    _, new_instance = from_url(redis_url[new_instance_number])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/project/venv/lib/python3.11/site-packages/redis_sentinel_url.py", line 162, in connect
    raise ValueError('Unsupported redis URL scheme: {}'.format(parsed_url.scheme))
ValueError: Unsupported redis URL scheme:

This is because of a change for compatibility with Flask 2.3.x (originally suggested in #419) that requires rq_dashboard.web.setup_rq_connection to be called explicitly (rather than having it called by Flask as it worked with Flask 2.2.x).

The changeset added the explicit call for command-line usage of rq-dashboard, but it is required for using it as a blueprint, too.