Open Mergim1992 opened 12 hours ago
Please also share the logs from the api docker container
Hi @mawoka-myblock ,
thanks for the fast response !
My docker container logs for the api:
root@ubuntu:/var/www/mysite/classquiz# docker logs --tail 100 classquiz_api_1
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
response = await self.dispatch_func(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/classquiz/__init__.py", line 78, in auth_middleware_wrapper
return await rememberme_middleware(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/classquiz/oauth/__init__.py", line 79, in rememberme_middleware
response: Response = await call_next(request)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
raise app_exc
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
with collapse_excgroups():
File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
response = await self.dispatch_func(request, call_next)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/classquiz/__init__.py", line 57, in sentry_exception
raise e
File "/app/classquiz/__init__.py", line 51, in sentry_exception
response = await call_next(request)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
raise app_exc
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/classquiz/routers/storage.py", line 138, in upload_file
await storage.upload(
File "/app/classquiz/storage/__init__.py", line 52, in upload
return await self.instance.upload(file=file_data, file_name=file_name, mime_type=mime_type, size=size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/classquiz/storage/local_storage.py", line 39, in upload
with open(file=os.path.join(self.base_path, file_name), mode="wb") as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/var/www/mysite/classquiz/uploads/e435ebe37fb743f190700205fcfdc09d'
172.27.0.5:59994 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:37808 - "POST /api/v1/login HTTP/1.1" 404
172.27.0.5:36112 - "POST /api/v1/auth/login HTTP/1.1" 404
172.27.0.5:35650 - "GET /api/v1/users/logout HTTP/1.1" 302
172.27.0.5:35930 - "POST /api/v1/login/start HTTP/1.1" 200
172.27.0.5:48660 - "POST /api/v1/login/step/1?session_id=cf8489c403134547ff5c9c0ca529f4be HTTP/1.1" 200
172.27.0.5:48660 - "POST /api/v1/editor/start?edit=false HTTP/1.1" 200
172.27.0.5:52586 - "POST /api/v1/login/start HTTP/1.1" 200
172.27.0.5:45850 - "POST /api/v1/editor/start?edit=false HTTP/1.1" 200
172.27.0.5:49366 - "GET /api/v1/quiz/list?page_size=100 HTTP/1.1" 200
172.27.0.5:49366 - "GET /api/v1/quiztivity/ HTTP/1.1" 200
172.27.0.5:36520 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:33946 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:56714 - "GET /api/v1/users/logout HTTP/1.1" 302
172.27.0.5:40766 - "POST /api/v1/login/start HTTP/1.1" 200
172.27.0.5:40766 - "POST /api/v1/login/step/1?session_id=eae8bb852b34fda6d4a61efc5ce9a1d0 HTTP/1.1" 200
172.27.0.5:40766 - "GET /api/v1/quiz/list?page_size=100 HTTP/1.1" 200
172.27.0.5:40766 - "GET /api/v1/quiztivity/ HTTP/1.1" 200
172.27.0.5:40766 - "GET /api/v1/quiz/get/d998c132-f780-4383-8dc6-a5f12d04ed4f HTTP/1.1" 200
172.27.0.5:40766 - "GET /api/v1/quiz/get/d998c132-f780-4383-8dc6-a5f12d04ed4f HTTP/1.1" 200
172.27.0.5:40766 - "POST /api/v1/editor/start?edit=true&quiz_id=d998c132-f780-4383-8dc6-a5f12d04ed4f HTTP/1.1" 200
172.27.0.5:42516 - "GET /api/v1/quiz/list?page_size=100 HTTP/1.1" 200
172.27.0.5:42516 - "GET /api/v1/quiztivity/ HTTP/1.1" 200
172.27.0.5:54814 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:54814 - "POST /api/v1/auth/refresh-token HTTP/1.1" 404
172.27.0.5:53980 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:58504 - "POST /api/v1/storage/ HTTP/1.1" 401
172.27.0.5:52642 - "GET /api/v1/users/logout HTTP/1.1" 302
172.27.0.5:45178 - "POST /api/v1/login/start HTTP/1.1" 200
172.27.0.5:47690 - "POST /api/v1/login/start HTTP/1.1" 200
172.27.0.5:47690 - "POST /api/v1/login/step/1?session_id=8f10e6a1eb2bf6eafb077b4be4660c0f HTTP/1.1" 200
172.27.0.5:47690 - "POST /api/v1/editor/start?edit=false HTTP/1.1" 200
172.27.0.5:57348 - "POST /api/v1/storage/ HTTP/1.1" 401
root@ubuntu:/var/www/mysite/classquiz#
meanwhile I also added a user in docker-compose.yml:
api:
build: &build_cfg
context: .
dockerfile: Dockerfile
restart: &restart always
depends_on: &depends
- db
- redis
**user: www-data**
environment: &env_vars
# --- DON'T CHANGE FROM HERE ---
Kind regards :-)
FileNotFoundError: [Errno 2] No such file or directory: '/var/www/mysite/classquiz/uploads/e435ebe37fb743f190700205fcfdc09d'
The directory /var/www/mysite/classquiz/uploads/
doesn't exist. Check your docker compose mounts
Which component is affected?
Media-Upload (.png)
Did the issue occur at ClassQuiz.de, or on a self-hosted instance?
On a self-hosted instance
How can the issue be reproduced?
Deploy the application using the provided docker-compose.yml and Nginx configuration. Attempt to upload a file using the Uppy interface. Observe the 500 Internal Server Error in the browser console logs.
docker-compose.yml:
quiz.mysite.de (nginx config):
Describe the bug (with screenshots if possible)
While attempting to upload files via the /api/v1/storage endpoint using Uppy in a Dockerized environment, the server returns a 500 Internal Server Error. The backend is running in a containerized setup with Nginx as the proxy, and file storage is configured using the local storage backend. The issue persists despite adding necessary CORS headers in the Nginx configuration.
This is the web-console error I receive when upload a picture:
Device
Desktop
Operating System
Linux Ubuntu 24.04
Browser
Safari, Firefox