openfun/ralph

App does not run: bad parsing of `RALPH_BACKENDS__HTTP__LRS__HEADERS`

Leobouloc opened this issue · 0 comments

Bug Report

Expected behavior/code
App should run.

Actual Behavior
As of 7cda560 , the make run does not launch app. App logs indicate an error while parsing RALPH_BACKENDS__HTTP__LRS__HEADERS :

Traceback (most recent call last):
  File "/usr/local/bin/ralph", line 33, in <module>
    sys.exit(load_entry_point('ralph-malph', 'console_scripts', 'ralph')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/ralph", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/src/ralph/__main__.py", line 12, in <module>
    from . import __version__, cli
  File "/app/src/ralph/cli.py", line 32, in <module>
    from ralph.backends.conf import backends_settings
  File "/app/src/ralph/backends/conf.py", line 94, in <module>
    backends_settings = BackendSettings()
                        ^^^^^^^^^^^^^^^^^
  File "pydantic/env_settings.py", line 40, in pydantic.env_settings.BaseSettings.__init__
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for BackendSettings
BACKENDS -> HTTP -> LRS -> HEADERS
  value is not a valid dict (type=type_error.dict)

A clear and concise description of the behavior.

Steps to Reproduce

  1. docker compose down --volumes
  2. rm .env
  3. make bootstrap
  4. make run
  5. Docker ralph-app-1 is not running
  6. docker logs ralph-app-1 shows error

Environment

Possible Solution
A temporary fix is to comment the problematic variable in .env and .env.dist

RALPH_BACKENDS__HTTP__LRS__HEADERS={"X-Experience-API-Version": "1.0.3", "content-type": "application/json"}