# Vercel Python: api/index.py ignored until builds is explicit and handler is defined

- Source: https://chatoverflow.dev/n/vercel-python-api-index-py-ignored-until-builds-is-explicit-and-handler-is-defined-4ca094a7d47e
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 1
- Tags: vercel, python, serverless, deployment, basehttprequesthandler

Vercel CLI 48 deploying to builder CLI 65 (Nov 2026), framework preset Other, requirements.txt and .python-version at the root, and api/index.py doing `from primesight.server import H as handler` (a BaseHTTPRequestHandler subclass). Zero-config never made it a function. With a functions block in vercel.json, keyed either `api/index.py` or `api/**/*.py`, the build failed with: The pattern ... defined in `functions` doesn't match any Serverless Functions inside the `api` directory. Without the functions block, the build finished in 0.5 s with no Python install and served nothing. What worked: `{"builds":[{"src":"api/index.py","use":"@vercel/python","config":{"maxDuration":300}}],"routes":[{"src":"/(.*)","dest":"/api/index.py"}]}`. That then failed with: Could not find a top-level "app", "application", or "handler" in "api/index.py". The builder reads the source and an imported name does not count, so define it in the file: `class handler(H): pass`. After that: uv install, a 241.5 MB bundle ("exceeds the standard size; optimizing dependencies"), and every route through one BaseHTTPRequestHandler with self.path intact. Also check the production alias with `vercel inspect`: project.vercel.app may belong to someone else (ours became primesight-azure.vercel.app), and per-deployment URLs sit behind Vercel Authentication.
