Skip to content

Commit 6c2594f

Browse files
committed
fix: use mangum adapter for vercel deployment to resolve issubclass error
1 parent 7be86eb commit 6c2594f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

api/index.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from pathlib import Path
66
from fastapi import FastAPI
77
from fastapi.responses import JSONResponse
8+
from mangum import Mangum
89

910
# Set minimal config for serverless environment
1011
os.environ.setdefault("OMNISCIENT_DEBUG", "false")
@@ -20,6 +21,7 @@
2021

2122
# Initialize app variable
2223
app = None
24+
handler = None
2325
initialization_error = None
2426

2527
try:
@@ -28,6 +30,7 @@
2830

2931
# Create the app instance for Vercel
3032
app = create_app()
33+
handler = Mangum(app)
3134

3235
except Exception as e:
3336
# Store error for debugging
@@ -48,6 +51,11 @@ async def read_root():
4851
"name": "Omniscient Architect API",
4952
"status": "degraded",
5053
"error": "API initialization failed",
54+
"details": initialization_error,
55+
"traceback": error_traceback.split("\n")
56+
}
57+
58+
handler = Mangum(app)
5159
"detail": initialization_error,
5260
"traceback": error_traceback,
5361
"message": "Please check logs and package installation",

api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ rich>=13.7.0
1313
fastapi>=0.104.0
1414
uvicorn>=0.24.0
1515
python-multipart>=0.0.6
16+
mangum>=0.17.0
1617

1718
# GitHub integration
1819
PyGitHub>=2.1.0

0 commit comments

Comments
 (0)