diff --git a/api_service/api_server.py b/api_service/api_server.py index d822763..5a65ca8 100644 --- a/api_service/api_server.py +++ b/api_service/api_server.py @@ -525,8 +525,14 @@ try: app.mount("/webhook", webhook_router) # Mount directly on the main app for simplicity # After mounting the webhook router log.info("Available routes in webhook_router:") + from fastapi.routing import APIRoute, Mount for route in webhook_router.routes: - log.info(f" {route.path} - {route.name} - {route.methods}") + if isinstance(route, APIRoute): + log.info(f" {route.path} - {route.name} - {route.methods}") + elif isinstance(route, Mount): + log.info(f" {route.path} - {route.name} - Mounted app or static files") + else: + log.info(f" {route.path} - {route.name} - Unknown route type") # Or, if you prefer to nest it under /api: # api_app.include_router(webhook_router, prefix="/webhooks", tags=["Webhooks"]) log.info("Webhook endpoints loaded and mounted successfully at /webhook") @@ -551,8 +557,14 @@ except ImportError as e: # Log the available routes for debugging log.info("Available routes in dashboard_api_app:") +from fastapi.routing import APIRoute, Mount for route in dashboard_api_app.routes: - log.info(f" {route.path} - {route.name} - {route.methods}") + if isinstance(route, APIRoute): + log.info(f" {route.path} - {route.name} - {route.methods}") + elif isinstance(route, Mount): + log.info(f" {route.path} - {route.name} - Mounted app or static files") + else: + log.info(f" {route.path} - {route.name} - Unknown route type") # Create a middleware for redirecting /discordapi to /api with a deprecation warning class DeprecationRedirectMiddleware(BaseHTTPMiddleware): @@ -610,8 +622,14 @@ async def verify_discord_token(authorization: str = Header(None)) -> str: # Log the available routes for debugging log.info("Available routes in main app:") +from fastapi.routing import APIRoute, Mount for route in app.routes: - log.info(f" {route.path} - {route.name} - {route.methods}") + if isinstance(route, APIRoute): + log.info(f" {route.path} - {route.name} - {route.methods}") + elif isinstance(route, Mount): + log.info(f" {route.path} - {route.name} - Mounted app or static files") + else: + log.info(f" {route.path} - {route.name} - Unknown route type") @app.get("/") async def root():