broken custom domain name ingestor `/docs` endpoint
emileten opened this issue · 0 comments
cc @jjfrench since you worked on the custom domain name PR!
The set up for the ingestor is as follows :
- one lambda is deployed as an "API handler", integrated to an API gateway REST API. It's the entry point for the ingestion execution, and the FastAPI application is defined and deployed in that lambda. The handler file imports our custom FastAPI application.
- another lambda, called by the above, handles ingestions themselves, with this other custom application.
In (1), we allow for a root_path
in the configuration, in cases e.g. where we want to define different stages in our proxy. With the current set up, all is well if we integrate (1) with an API gateway REST API as proxy.
However, if on top of that we map that REST API to a custom domain name, I noticed that the /docs
endpoint is inaccessible. More specifically, it returns something like this :
I noticed that doing this solves the problem, but I am not sure to understand 100% why yet. [Taken from here]. The solution is, in the handler in (1), to pass to the Mangum
constructor's api_gateway_base_path
parameter the value of root_path
.
Like this :
from mangum import Mangum
from .main import app
handler = Mangum(app, lifespan="off", api_gateway_base_path=app.root_path) # or something like that if the root path is exposed