Skip to content

Exception in ASGI application with newest Fastapi #45

Closed
@Sieboldianus

Description

@Sieboldianus

I've successfully used the Fullstack fastapi template in the past. With the recent version of fastapi installed through the Dockerfile, I get the following error when I log on to docker-compose logs -f backend and open up https://localhost/:

backend_1        | INFO: ('172.22.0.2', 39320) - "GET /api/v1/users/me HTTP/1.1" 500
backend_1        | ERROR: Exception in ASGI application
backend_1        | Traceback (most recent call last):
backend_1        |   File "/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py", line 368, in run_asgi
backend_1        |     result = await app(self.scope, self.receive, self.send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 133, in __call__
backend_1        |     await self.error_middleware(scope, receive, send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 122, in __call__
backend_1        |     raise exc from None
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py", line 100, in __call__
backend_1        |     await self.app(scope, receive, _send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/base.py", line 25, in __call__
backend_1        |     response = await self.dispatch_func(request, self.call_next)
backend_1        |   File "./app/main.py", line 34, in db_session_middleware
backend_1        |     response = await call_next(request)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/base.py", line 45, in call_next
backend_1        |     task.result()
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/base.py", line 38, in coro
backend_1        |     await self.app(scope, receive, send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/middleware/cors.py", line 76, in __call__
backend_1        |     await self.app(scope, receive, send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 73, in __call__
backend_1        |     raise exc from None
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/exceptions.py", line 62, in __call__
backend_1        |     await self.app(scope, receive, sender)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 585, in __call__
backend_1        |     await route(scope, receive, send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 207, in __call__
backend_1        |     await self.app(scope, receive, send)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/starlette/routing.py", line 40, in app
backend_1        |     response = await func(request)
backend_1        |   File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 122, in app
backend_1        |     skip_defaults=response_model_skip_defaults,
backend_1        |   File "/usr/local/lib/python3.7/site-packages/fastapi/routing.py", line 54, in serialize_response
backend_1        |     raise ValidationError(errors)
backend_1        | pydantic.error_wrappers.ValidationError: 1 validation error
backend_1        | response
backend_1        |   value is not a valid dict (type=type_error.dict)

There's a small chance that this error relates to some code edits I have introduced, but I suspect this is related to the latest changes to how pydantic validates models in newer Fastapi versions. Anyone else experiencing this? I haven't tested it with a fresh full-stack-fastapi-postgresql, but will check as soon as possible..

Just a note: login still works, perhaps this is just a backend error with no consequences, it is still annoying seeing this error every time the login screen is requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions