GET `/camera/camera_configuration` returns an error

Open
#12 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fastapi, python
Domain
api

Research direction

Start at the GET /camera/camera_configuration endpoint and inspect how its response is assembled and serialized by FastAPI and Pydantic. Reproduce the request, then trace the libcamera._libcamera.Transform value shown in the traceback. Done means the endpoint returns a successfully serialized camera configuration instead of a 500 error.

Written by the indexing model from the issue text.

Description

Terminal log:

INFO:     192.168.178.28:49834 - "GET /camera/camera_configuration HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.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 "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 327, in app
    content = await serialize_response(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 181, in serialize_response
    return field.serialize(
           ^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/fastapi/_compat.py", line 150, in serialize
    return self._type_adapter.dump_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/pydantic/type_adapter.py", line 135, in wrapped
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/openflexure/application/openflexure-microscope-server/.venv/lib/python3.11/site-packages/pydantic/type_adapter.py", line 451, in dump_python
    return self.serializer.to_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'libcamera._libcamera.Transform'>
Dominant language
Python
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from labthings/labthings-picamera2

All issues in labthings/labthings-picamera2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.