I’m deploying a development branch as preview with a FastAPI backend located at src/api/index.py. When hitting the api/auth/me route, I’m getting a ModuleNotFoundError: No module named 'pydantic_core._pydantic_core
The code in src/api/index.py has changed very little compared to the current production deployment (only a few lines were added). The requirements in src/api/pyproject.toml are identical to what’s deployed in production with pinned versions I know are present in the current production version.
The build completes successfully and the Python dependencies install without errors, but at runtime in the Vercel Function Lambda environment, pydantic_core cannot be found. I suspect this issue is due to a changed way in which Vercel bundles Python functions in the Lambda environment.
The current behaviour is the one described, the expected one is for the backend to run smoothly since the requirements did not change.
In production pyproject.toml
[project]
name = "my-prj-api"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"boto3>=1.40.61",
"fastapi>=0.120.0",
"pydantic>=2.12.3",
"python-dotenv>=1.1.1",
"requests>=2.32.5",
"supabase>=2.22.2",
"uvicorn[standard]>=0.38.0",
]
[dependency-groups]
dev = [
"pytest>=8.4.2",
"ruff>=0.14.6",
"mypy>=1.18.2",
"boto3-stubs>=1.41.4",
"types-requests>=2.32.4.20250913",
]
development branch pyproject.toml with pinned versions as per the ones in the last production deployment
[project]
name = "timely-api"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"boto3>=1.40.61",
"fastapi==0.120.1",
"pydantic==2.12.3",
"pydantic-settings==2.11.0",
"pydantic-core==2.41.4",
"python-dotenv>=1.1.1",
"requests>=2.32.5",
"supabase>=2.22.2",
"uvicorn[standard]>=0.38.0",
]
[dependency-groups]
dev = [
"pytest>=8.4.2",
"ruff>=0.14.6",
"mypy>=1.18.2",
"boto3-stubs>=1.41.4",
"types-requests>=2.32.4.20250913",
]
Anyone experiencing the same?
