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] - Internal Server Error when changing Authentication Method #3282

Closed
6 tasks done
cmintey opened this issue Mar 10, 2024 · 5 comments · Fixed by #3283
Closed
6 tasks done

[BUG] - Internal Server Error when changing Authentication Method #3282

cmintey opened this issue Mar 10, 2024 · 5 comments · Fixed by #3283
Labels
bug: confirmed bug Something isn't working

Comments

@cmintey
Copy link
Contributor

cmintey commented Mar 10, 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?

Attempting to change a user's Authentication Method in user management fails with a 500 status.

Steps to Reproduce

  1. Login as admin
  2. Navigate to user management screen
  3. Click on a user who has favorite recipes
  4. Attempt to change the auth method to something else

Please provide relevant logs

mealie     | INFO:     10.0.2.1:0 - "PUT /api/admin/users/30c18e66-16ba-4248-937b-97dbf79ee078 HTTP/1.1" 500 Internal Server Error
mealie     | ERROR:    Exception in ASGI application
mealie     | Traceback (most recent call last):
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 412, in run_asgi
mealie     |     result = await app(  # type: ignore[func-returns-value]
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
mealie     |     return await self.app(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
mealie     |     await super().__call__(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
mealie     |     await self.middleware_stack(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
mealie     |     raise exc
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
mealie     |     await self.app(scope, receive, _send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
mealie     |     await responder(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__
mealie     |     await self.app(scope, receive, self.send_with_gzip)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
mealie     |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
mealie     |     raise exc
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
mealie     |     await app(scope, receive, sender)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 758, in __call__
mealie     |     await self.middleware_stack(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 778, in app
mealie     |     await route.handle(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 299, in handle
mealie     |     await self.app(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 79, in app
mealie     |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
mealie     |     raise exc
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
mealie     |     await app(scope, receive, sender)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 74, in app
mealie     |     response = await func(request)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 269, in app
mealie     |     solved_result = await solve_dependencies(
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py", line 626, in solve_dependencies
mealie     |     ) = await request_body_to_args(  # body_params checked above
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/dependencies/utils.py", line 756, in request_body_to_args
mealie     |     v_, errors_ = field.validate(value, values, loc=loc)
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/_compat.py", line 125, in validate
mealie     |     self._type_adapter.validate_python(value, from_attributes=True),
mealie     |   File "/opt/pysetup/.venv/lib/python3.10/site-packages/pydantic/type_adapter.py", line 256, in validate_python
mealie     |     return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
mealie     |   File "/app/mealie/schema/user/user.py", line 123, in convert_favorite_recipes_to_slugs
mealie     |     return [recipe.slug for recipe in v] if v else v
mealie     |   File "/app/mealie/schema/user/user.py", line 123, in <listcomp>
mealie     |     return [recipe.slug for recipe in v] if v else v
mealie     | AttributeError: 'str' object has no attribute 'slug'

Mealie Version

Nightly (5f6844e)

Deployment

Docker (Linux)

Additional Deployment Details

No response

@cmintey cmintey added bug Something isn't working triage labels Mar 10, 2024
@cmintey
Copy link
Contributor Author

cmintey commented Mar 10, 2024

Seems related to #3134

@cmintey
Copy link
Contributor Author

cmintey commented Mar 10, 2024

Seems also to only affect users with favorite recipes

@boc-the-git
Copy link
Collaborator

Seems also to only affect users with favorite recipes

Interesting conclusion.

Is it possible to replicate on demo now that you know that?

@cmintey
Copy link
Contributor Author

cmintey commented Mar 10, 2024

Is it possible to replicate on demo now that you know that?

The demo site doesn't look to be updated yet

Yeah I was able to replicate on demo. I created a new user (see test user), logged in as that user, favorited a recipe, then went to try to change the auth method and received error.

If I un-favorite the recipe, I am then able to change the auth method

@michael-genson
Copy link
Collaborator

Thanks for the report! Just opened a PR to fix it

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

Successfully merging a pull request may close this issue.

3 participants