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

[BUG] - Unable to delete user with Postgresql #4472

Open
5 of 6 tasks
daxxio opened this issue Oct 30, 2024 · 0 comments
Open
5 of 6 tasks

[BUG] - Unable to delete user with Postgresql #4472

daxxio opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working triage

Comments

@daxxio
Copy link

daxxio commented Oct 30, 2024

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

I am trying to delete a user from mealie but am unable to do so. The following error added in the logs is showing up.

Steps to Reproduce

  1. Have an instance with Postgresql.
  2. Go to Users
  3. Select a user and click delete

Please provide relevant logs

ERROR    2024-10-30T12:39:27 - DELETE statement on table 'users_to_recipes' expected to delete 2 row(s); Only 0 were matched.

Traceback (most recent call last):

  File "/app/mealie/routes/_base/mixins.py", line 120, in delete_one

    item = self.repo.delete(item_id)

  File "/app/mealie/repos/repository_users.py", line 62, in delete

    entry = super().delete(value, match_key)

  File "/app/mealie/repos/repository_generic.py", line 250, in delete

    raise e

  File "/app/mealie/repos/repository_generic.py", line 247, in delete

ERROR    2024-10-30T12:39:27 - DELETE statement on table 'users_to_recipes' expected to delete 2 row(s); Only 0 were matched.

    self.session.commit()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2028, in commit

Traceback (most recent call last):

    trans.commit(_to_root=True)

  File "/app/mealie/routes/_base/mixins.py", line 120, in delete_one

  File "<string>", line 2, in commit

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

    ret_value = fn(self, *arg, **kw)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1313, in commit

    self._prepare_impl()

    item = self.repo.delete(item_id)

  File "/app/mealie/repos/repository_users.py", line 62, in delete

    entry = super().delete(value, match_key)

  File "/app/mealie/repos/repository_generic.py", line 250, in delete

    raise e

  File "/app/mealie/repos/repository_generic.py", line 247, in delete

    self.session.commit()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2028, in commit

    trans.commit(_to_root=True)

  File "<string>", line 2, in commit

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

    ret_value = fn(self, *arg, **kw)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1313, in commit

    self._prepare_impl()

  File "<string>", line 2, in _prepare_impl

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

  File "<string>", line 2, in _prepare_impl

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

    ret_value = fn(self, *arg, **kw)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1288, in _prepare_impl

    self.session.flush()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4352, in flush

    self._flush(objects)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4487, in _flush

    ret_value = fn(self, *arg, **kw)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1288, in _prepare_impl

    self.session.flush()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4352, in flush

    self._flush(objects)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4487, in _flush

    with util.safe_reraise():

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__

    raise exc_value.with_traceback(exc_tb)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4448, in _flush

    flush_context.execute()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute

    rec.execute(self)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute

    self.dependency_processor.process_deletes(uow, states)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 1120, in process_deletes

    self._run_crud(

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 1222, in _run_crud

    raise exc.StaleDataError(

sqlalchemy.orm.exc.StaleDataError: DELETE statement on table 'users_to_recipes' expected to delete 2 row(s); Only 0 were matched.

    with util.safe_reraise():

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalche
/my/util/langhelpers.py", line 146, in __exit__

    raise exc_value.with_traceback(exc_tb)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4448, in _flush

    flush_context.execute()

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute

    rec.execute(self)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute

    self.dependency_processor.process_deletes(uow, states)

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 1120, in process_deletes

    self._run_crud(

  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 1222, in _run_crud

    raise exc.StaleDataError(

sqlalchemy.orm.exc.StaleDataError: DELETE statement on table 'users_to_recipes' expected to delete 2 row(s); Only 0 were matched.

INFO     2024-10-30T12:39:27 - [_PublicIPRemoved_:0] 400 Bad Request "DELETE /api/users/ed59ebfd-998c-4aaf-be3a-084b548aa528 HTTP/1.1"

Mealie Version

hkotel/mealie:latest, freshly pulled from docker, i believe it's 2.1.0

Deployment

Docker (Synology)

Additional Deployment Details

Portainer stack with docker.io/library/postgres:16-alpine

@daxxio daxxio added bug Something isn't working triage labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant