pyronear / pyro-api

Alert Management API for wildfire prevention, detection & monitoring. Built with FastAPI & PostgreSQL
Apache License 2.0
21 stars 9 forks source link

SUPPORT_EMAIL required to access http://localhost:5050/docs? #384

Open vanderlindenma opened 2 weeks ago

vanderlindenma commented 2 weeks ago

Following the Installation instructions on the Readme, everything works well including

docker compose pull
docker compose up
Screenshot 2024-10-30 at 11 52 35 AM

but I am getting errors when I try to access http://localhost:5050/docs.

INFO:     192.168.65.1:31721 - "GET /api/v1/openapi.json HTTP/1.1" 500 Internal Server Error
backend-1     | ERROR:    Exception in ASGI application
backend-1     | Traceback (most recent call last):
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 159, in call_next
backend-1     |     message = await recv_stream.receive()
backend-1     |   File "/usr/local/lib/python3.9/site-packages/anyio/streams/memory.py", line 98, in receive
backend-1     |     return self.receive_nowait()
backend-1     |   File "/usr/local/lib/python3.9/site-packages/anyio/streams/memory.py", line 91, in receive_nowait
backend-1     |     raise EndOfStream
backend-1     | anyio.EndOfStream
backend-1     | 
backend-1     | During handling of the above exception, another exception occurred:
backend-1     | 
backend-1     | Traceback (most recent call last):
backend-1     |   File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
backend-1     |     result = await app(  # type: ignore[func-returns-value]
backend-1     |   File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
backend-1     |     return await self.app(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in __call__
backend-1     |     await super().__call__(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 123, in __call__
backend-1     |     await self.middleware_stack(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in __call__
backend-1     |     raise exc
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in __call__
backend-1     |     await self.app(scope, receive, _send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/prometheus_fastapi_instrumentator/middleware.py", line 169, in __call__
backend-1     |     raise exc
backend-1     |   File "/usr/local/lib/python3.9/site-packages/prometheus_fastapi_instrumentator/middleware.py", line 167, in __call__
backend-1     |     await self.app(scope, receive, send_wrapper)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 85, in __call__
backend-1     |     await self.app(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 191, in __call__
backend-1     |     response = await self.dispatch_func(request, call_next)
backend-1     |   File "/app/app/main.py", line 67, in add_process_time_header
backend-1     |     response = await call_next(request)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 165, in call_next
backend-1     |     raise app_exc
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 151, in coro
backend-1     |     await self.app(scope, receive_or_disconnect, send_no_error)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
backend-1     |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
backend-1     |     raise exc
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
backend-1     |     await app(scope, receive, sender)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__
backend-1     |     await self.middleware_stack(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 776, in app
backend-1     |     await route.handle(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 297, in handle
backend-1     |     await self.app(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 77, in app
backend-1     |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
backend-1     |     raise exc
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
backend-1     |     await app(scope, receive, sender)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 72, in app
backend-1     |     response = await func(request)
backend-1     |   File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 1009, in openapi
backend-1     |     return JSONResponse(self.openapi())
backend-1     |   File "/app/app/main.py", line 103, in custom_openapi
backend-1     |     openapi_schema = get_openapi(
backend-1     |   File "/usr/local/lib/python3.9/site-packages/fastapi/openapi/utils.py", line 530, in get_openapi
backend-1     |     return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True)  # type: ignore
backend-1     |   File "/usr/local/lib/python3.9/site-packages/pydantic/main.py", line 164, in __init__
backend-1     |     __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
backend-1     | pydantic_core._pydantic_core.ValidationError: 1 validation error for OpenAPI
backend-1     | info.contact.email

Seems related to the SUPPORT_EMAIL that is marked as optional but appears required.

https://github.com/pyronear/pyro-api/blob/0248df7d1d95ecf634527efe2e3f76781904ae2d/.env.example#L23

When I supply a dummy email like SUPPORT_EMAIL='test@yahoo.fr' I am able to access http://localhost:5050/docs.