I've recently upgraded our Heroku Redis from version 5.0 to 7.0.11 and I'm now receiving the following error when running Celery
Traceback (most recent call last):
File "/app/.heroku/python/bin/celery", line 8, in <module>
sys.exit(main())
File "/app/.heroku/python/lib/python3.8/site-packages/celery/__main__.py", line 15, in main
sys.exit(_main())
File "/app/.heroku/python/lib/python3.8/site-packages/celery/bin/celery.py", line 235, in main
return celery(auto_envvar_prefix="CELERY")
File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/app/.heroku/python/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/celery/bin/base.py", line 134, in caller
return f(ctx, *args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/celery/bin/worker.py", line 348, in worker
worker = app.Worker(
File "/app/.heroku/python/lib/python3.8/site-packages/celery/worker/worker.py", line 98, in __init__
self.setup_instance(**self.prepare_args(**kwargs))
File "/app/.heroku/python/lib/python3.8/site-packages/celery/worker/worker.py", line 119, in setup_instance
self._conninfo = self.app.connection_for_read()
File "/app/.heroku/python/lib/python3.8/site-packages/celery/app/base.py", line 818, in connection_for_read
return self._connection(url or self.conf.broker_read_url, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/celery/app/base.py", line 877, in _connection
return self.amqp.Connection(
File "/app/.heroku/python/lib/python3.8/site-packages/kombu/connection.py", line 203, in __init__
url_params = parse_url(hostname)
File "/app/.heroku/python/lib/python3.8/site-packages/kombu/utils/url.py", line 50, in parse_url
query['ssl'][key] = query[key]
TypeError: 'str' object does not support item assignment
celery.py
from celery import Celery
app = Celery('endpoints')
# namespace='CELERY' means all celery-related configuration keys should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
app.conf.redis_backend_use_ssl = {
'ssl_cert_reqs': 'CERT_NONE'
}
app.conf.broker_use_ssl = {
'ssl_cert_reqs': 'CERT_NONE'
}
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
requirements.txt
dj-database-url==2.0.0
Django==4.2.2
django-environ==0.9.0
django-storages==1.9.1
djangorestframework==3.14.0
django-cors-headers==3.5.0
django-parler==2.3
redis==4.5.5
celery[redis]==5.3.0
Everything was working flawlessly prior to the upgrade, but this error is causing celery to crash immediately.