saleor / saleor-platform

All Saleor services started from a single repository with docker-compose.
BSD 3-Clause "New" or "Revised" License
650 stars 889 forks source link

Unknown backend exception with CACHE_URL environment variable #281

Closed dhunav108 closed 1 year ago

dhunav108 commented 1 year ago

Hello. We have our saleor frontend up and running through AWS ECS. saleor-dashboard, saleor-api, jaegar and mailpit run in their own containers. We are using a AWS Elasticache Redis cluster for caching.

For saleor-worker container, the CACHE_URL (or REDIS_URL) env var causes an exception: Exception: Unknown backend: "clustername.1abcde.ng.0001.use1.cache.amazonaws.com"

The value for CACHE_URL is clustername.1abcde.ng.0001.use1.cache.amazonaws.com:6379. If it helps, same exception occurs if we pass CACHE_URL to the saleor-api container too.

What is the reason of the exception? On the same note, can you also explain (or point me to the right docs) the usage of saleor-worker container?

saleor docker image version: 3.14.2

Full container logs:

<html><body>
<!--StartFragment-->

Traceback (most recent call last):
--
File "/usr/local/bin/celery", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/celery/__main__.py", line 15, in main
sys.exit(_main())
File "/usr/local/lib/python3.9/site-packages/celery/bin/celery.py", line 217, in main
return celery(auto_envvar_prefix="CELERY")
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1655, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 920, in make_context
self.parse_args(ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1378, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 2360, in handle_parse_result
value = self.process_value(ctx, value)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 2322, in process_value
value = self.callback(ctx, self, value)
File "/usr/local/lib/python3.9/site-packages/celery/bin/worker.py", line 160, in <lambda>
value: value or ctx.obj.app.conf.worker_state_db,
File "/usr/local/lib/python3.9/site-packages/celery/utils/collections.py", line 112, in __getattr__
return self[k]
File "/usr/local/lib/python3.9/site-packages/celery/utils/collections.py", line 392, in __getitem__
return getitem(k)
File "/usr/local/lib/python3.9/site-packages/celery/utils/collections.py", line 250, in __getitem__
return mapping[_key]
File "/usr/local/lib/python3.9/collections/__init__.py", line 1054, in __getitem__
if key in self.data:
File "/usr/local/lib/python3.9/site-packages/kombu/utils/objects.py", line 32, in __get__
return super().__get__(instance, owner)
File "/usr/local/lib/python3.9/functools.py", line 993, in __get__
val = self.func(instance)
File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 138, in data
return self.callback()
File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 967, in _finalize_pending_conf
conf = self._conf = self._load_config()
File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 977, in _load_config
self.loader.config_from_object(self._config_source)
File "/usr/local/lib/python3.9/site-packages/celery/loaders/base.py", line 128, in config_from_object
self._conf = force_mapping(obj)
File "/usr/local/lib/python3.9/site-packages/celery/utils/collections.py", line 43, in force_mapping
if isinstance(m, (LazyObject, LazySettings)):
File "/usr/local/lib/python3.9/site-packages/django/utils/functional.py", line 246, in inner
self._setup()
File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/app/saleor/settings.py", line 772, in <module>
CACHES = {"default": django_cache_url.config()}
File "/usr/local/lib/python3.9/site-packages/django_cache_url/__init__.py", line 61, in config
config = parse(s)
File "/usr/local/lib/python3.9/site-packages/django_cache_url/__init__.py", line 78, in parse
raise Exception(f'Unknown backend: "{url.scheme}"')
Exception: Unknown backend: "clustername.1abcde.ng.0001.use1.cache.amazonaws.com"

<!--EndFragment-->
</body>
</html>
dhunav108 commented 1 year ago

My bad I was missing the redis:// prefix.