Having a similar problem with the rqworker command connecting to an upstash redis instance:
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
"/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
"/opt/venv/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
"/opt/venv/lib/python3.10/site-packages/django_rq/management/commands/rqworker.py", line 122, in handle
w = get_worker(*args, **worker_kwargs)
"/opt/venv/lib/python3.10/site-packages/django_rq/workers.py", line 51, in get_worker
return worker_class(queues,
File "/opt/venv/lib/python3.10/site-packages/rq/worker.py", line 228, in __init__
self.ip_address = [
IndexError: list index out of range
I’ve tried connecting with the resolved ipv6 address and got the same exception.
Weird thing is, Django’s redis cache works fine, just the worker failing.
This was working fine on Heroku and I made a Redis cluster on Render and it worked there as well. REDIS_URL is the value of my Upstash URL that was provided.
Are you appending the /0 database as well? Another thing to consider is the Upstash IPs are IPv6 addresses. That doesn’t seem like it should cause problems, but worth noting in case something specific is needed to make that work with Python.
UPDATE: I tried this using the redis library required by rq:
import redis
r = redis.Redis.from_url(“redis://default:mypass@fly-myhost.upstash.io”)
Redis<ConnectionPool<Connection<host=fly-myhost.upstash.io,port=6379,db=0>>>
r.set(‘a’, 1)
True