Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken custom domain name ingestor /docs endpoint #79

Closed
1 task
emileten opened this issue Oct 13, 2023 · 0 comments · Fixed by #82
Closed
1 task

broken custom domain name ingestor /docs endpoint #79

emileten opened this issue Oct 13, 2023 · 0 comments · Fixed by #82

Comments

@emileten
Copy link
Contributor

emileten commented Oct 13, 2023

cc @jjfrench since you worked on the custom domain name PR!

The set up for the ingestor is as follows :

  1. 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.
  2. 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 :

Screenshot 2023-10-13 at 4 38 32 PM

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

Tasks

Preview Give feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant