Skip to content

Fix: use glob pattern in vercel.json functions key#4

Merged
chengh42 merged 5 commits into
mainfrom
fix-vercel-function-pattern
Apr 14, 2026
Merged

Fix: use glob pattern in vercel.json functions key#4
chengh42 merged 5 commits into
mainfrom
fix-vercel-function-pattern

Conversation

@chengh42

Copy link
Copy Markdown
Member

Description

Fixes the production deploy failure:

Error: The pattern "api/index.py" defined in `functions` doesn't match
any Serverless Functions inside the `api` directory.

Vercel CLI 51+ validates that the functions key contains a glob pattern (not a literal path). Changed "api/index.py""api/**/*.py", which is the documented correct form per the Vercel Python runtime docs.

One-line diff in vercel.json.

Vercel CLI 51+ requires a glob pattern in the `functions` key, not an
exact file path.  "api/index.py" was rejected with "doesn't match any
Serverless Functions"; "api/**/*.py" is the documented correct form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
taken Ready Ready Preview, Comment Apr 14, 2026 5:28pm

Both exact-path and glob patterns in the `functions` key fail with
"doesn't match any Serverless Functions" — meaning Vercel's auto-
detection isn't finding the Python function before the validation runs.

Dropping the `functions` key entirely lets Vercel auto-detect
api/index.py as a Python serverless function without the validation
step blocking the build.  The excludeFiles optimisation can be
re-added once the base deployment is confirmed working.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Vercel scans the `app/` directory for recognised Python entrypoint
filenames (main.py, app.py, server.py, index.py, wsgi.py, asgi.py) and
treats any match as a serverless function.  `app/main.py` was being
detected and imported directly — without the project dependencies
installed — causing FUNCTION_INVOCATION_FAILED on every request.

Renaming to `application.py` (not in Vercel's detection list) makes
`api/index.py` the sole entry point as intended.

Updated: api/index.py, tests/conftest.py, CLAUDE.md, README.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
httpx was only in [dev] extras, so Vercel (which runs pip install . not
pip install .[dev]) did not install it.  httpx is used in production
code (app/services/foys.py) so it belongs in the main dependency list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All dependencies are now declared in pyproject.toml. Vercel reads
pyproject.toml directly (pip install .), so requirements.txt was
redundant and could cause confusion about which file is authoritative.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chengh42
chengh42 merged commit 6af711a into main Apr 14, 2026
3 checks passed
@chengh42
chengh42 deleted the fix-vercel-function-pattern branch April 14, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant