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

ValidationError while annotating #4

Closed
vogelbam opened this issue Jan 31, 2024 · 2 comments
Closed

ValidationError while annotating #4

vogelbam opened this issue Jan 31, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vogelbam
Copy link
Contributor

vogelbam commented Jan 31, 2024

  • Whombat version: 0.4.0 (71c7519)
  • Python version: 3.11
  • Operating System: Ubuntu 23.10

Description

Trying to add annotations, the app returns raises a ValidationError while getting the current active user. The code in commit 8f6adf9 works fine for me. The following commit might have broken authentication. I think the same applies to other actions too.

What I Did

I've setup Whombat, created a user, a dataset and an annotation task. When I try to add any kind of annotation (e.g. a bounding box), I receive an internal server error. Running dev mode or adding a super user does not change this behavior.

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/applications.py", line 116, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
    await self.app(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
    raise exc
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
    await app(scope, receive, sender)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/routing.py", line 746, in __call__
    await route.handle(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/routing.py", line 75, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app
    raise exc
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app
    await app(scope, receive, sender)
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/starlette/routing.py", line 70, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 285, in app
    raise e
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 275, in app
    solved_result = await solve_dependencies(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 598, in solve_dependencies
    solved = await call(**sub_values)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/src/whombat/routes/dependencies/auth.py", line 48, in get_current_user
    return schemas.SimpleUser.model_validate(current_active_user)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vogelbam/projects/whombat/back/.venv/lib/python3.11/site-packages/pydantic/main.py", line 503, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for SimpleUser
  Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value=<function Authenticator.c...dency at 0x7f22f008e700>, input_type=function]
    For further information visit https://errors.pydantic.dev/2.5/v/model_attributes_type
@mbsantiago
Copy link
Owner

Hi @vogelbam, thanks for the issue! Will have a look into this.

@mbsantiago mbsantiago self-assigned this Jan 31, 2024
@mbsantiago mbsantiago added the bug Something isn't working label Jan 31, 2024
mbsantiago added a commit that referenced this issue Feb 1, 2024
Fix authentication issue raised at #4.
@mbsantiago
Copy link
Owner

@vogelbam,
I've located the issue and it should be solved in the new release. Let me know if you encounter further issues. Thanks again!

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

2 participants