diff --git a/integrations/jira/main.py b/integrations/jira/main.py index ec128e6f1c..0b439e0989 100644 --- a/integrations/jira/main.py +++ b/integrations/jira/main.py @@ -79,9 +79,6 @@ async def handle_webhook_request(data: dict[str, Any]) -> dict[str, Any]: return {"ok": True} -ocean.app.fast_api_app.include_router(ocean.router, prefix="/integration") - - # Called once when the integration starts. @ocean.on_start() async def on_start() -> None: diff --git a/port_ocean/ocean.py b/port_ocean/ocean.py index 7eb7769a89..60a2f6235f 100644 --- a/port_ocean/ocean.py +++ b/port_ocean/ocean.py @@ -54,7 +54,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]: signal_handler.exit() self.fast_api_app = app or FastAPI(lifespan=lifespan) - # self.fast_api_app.middleware("http")(request_handler) + self.fast_api_app.middleware("http")(request_handler) self.config = IntegrationConfiguration( # type: ignore @@ -67,6 +67,7 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]: *self.config.get_sensitive_fields_data() ) self.integration_router = integration_router or APIRouter() + self.integration_router_included = False self.port_client = PortClient( base_url=self.config.port.base_url, @@ -127,4 +128,10 @@ async def execute_resync_all() -> None: await repeated_function() async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + if not self.integration_router_included: + self.fast_api_app.include_router( + self.integration_router, prefix="/integration" + ) + self.integration_router_included = True + await self.fast_api_app(scope, receive, send) diff --git a/pyproject.toml b/pyproject.toml index d3dd9cfbc1..857e274062 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "port-ocean" -version = "0.12.9-dev01" +version = "0.12.9-dev02" description = "Port Ocean is a CLI tool for managing your Port projects." readme = "README.md" homepage = "https://app.getport.io"