Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup restore fails with Error 500 #1438

Closed
hmoens opened this issue Jan 28, 2025 · 3 comments
Closed

Backup restore fails with Error 500 #1438

hmoens opened this issue Jan 28, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@hmoens
Copy link

hmoens commented Jan 28, 2025

Describe the bug
I'm using the ciso-assistant-next Helm chart to deploy ciso assistant on a K8s cluster. I use an external pgsql database. When trying to restore a backup from a local test instance deployed using docker-compose, executing the restore results in a "Error 500 Internal Error" message.

The logs of the backend pod show the following error message, which shows ciso assistant is attempting to use sqlite even though the instance is configured to use pgsql, which is a potential lead:

Traceback (most recent call last):
  File "/code/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/serdes/views.py", line 171, in post
    return self.load_backup(
           ^^^^^^^^^^^^^^^^^
  File "/code/serdes/views.py", line 65, in load_backup
    with open(SQLITE_FILE, "rb") as database_file:
         ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/code/db/ciso-assistant.sqlite3'
Internal Server Error: /api/serdes/load-backup/
Traceback (most recent call last):
  File "/code/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/code/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/serdes/views.py", line 171, in post
    return self.load_backup(
           ^^^^^^^^^^^^^^^^^
  File "/code/serdes/views.py", line 65, in load_backup
    with open(SQLITE_FILE, "rb") as database_file:
         ^^^^^^^^^^^^^^^^^^^^^^^

Relevant chart configuration:
backed.config.databaseType: "externalPgsql"
global.image.tag: "v2.0.12"

To Reproduce
Steps to reproduce the behavior:

  1. Deploy the ciso-assistant-next helm chart using pgsql
  2. Click on 'backup & restore'
  3. Restore a backup created using the default docker-compose
  4. See error

Expected behavior
The database to be restored or a clearer error message to be shown

Environment (please complete the following information):

  • Browser: Encountered using Firefox on Ubuntu 24.10
  • Version: ciso-assistant-next Helm chart using image tag v2.0.12

Additional context

@ab-smith ab-smith added the question Further information is requested label Jan 28, 2025
@nas-tabchiche nas-tabchiche added bug Something isn't working and removed question Further information is requested labels Feb 7, 2025
@nas-tabchiche
Copy link
Contributor

Hi @hmoens, thanks for reaching out. This was fixed with #1477, it was merged on main, and will be part of the next release. I will close this once the release is out.

@hmoens
Copy link
Author

hmoens commented Feb 18, 2025

I just managed to do a backup-restore from v2.2.1, so this issue seems to be resolved now

@ab-smith
Copy link
Contributor

Great. Thank you for the confirmation, and I am closing this accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants