Bug Overview
On the current deployment, all /api/* requests return the Single-Page Application (SPA) HTML instead of invoking the intended serverless API function. This is blocking all API access in production (e.g., /api/v1/meta).
Root Cause Analysis
vercel.json sets outputDirectory: "dist", which means Vercel expects all serverless functions (e.g., api/index.js) to be emitted under dist/api/.
- Current bundling script (
scripts/bundle-api.mjs) outputs api/index.js at the project root, not under dist/.
- As a result, Vercel fails to find the API function and falls back to the SPA route, returning HTML for all API calls.
Why the recent code changes (PR #1001) did not help
- The PR swapped out the request listener for
@hono/node-server/vercel's recommended handle() function but did not address the output path mismatch.
- None of the recent fixes made the function discoverable under
dist/.
Evidence
- Current
vercel.json:
"outputDirectory": "dist",
"rewrites": [
{ "source": "/api/(.*)", "destination": "/api" },
{ "source": "/((?!api/).*)", "destination": "/index.html" }
]
- Build script (as of 2026-03-31):
// scripts/bundle-api.mjs
outfile: 'api/index.js' // should be 'dist/api/index.js'
Steps to reproduce
- Deploy current
main branch to Vercel.
- Open
/api/v1/meta or any /api/* endpoint.
- See HTML response instead of JSON.
Severity
- Critical — All API functionality in Studio Vercel deployment is broken.
What needs to be fixed
- Update
outfile: in bundle-api.mjs to dist/api/index.js.
- (Optional) Add Vercel
functions config to be explicit about the function entrypoint.
- Ensure all references and docs expect the API output under
dist/api/.
Acceptance Criteria
/cc @hotlong
Bug Overview
On the current deployment, all
/api/*requests return the Single-Page Application (SPA) HTML instead of invoking the intended serverless API function. This is blocking all API access in production (e.g.,/api/v1/meta).Root Cause Analysis
vercel.jsonsetsoutputDirectory: "dist", which means Vercel expects all serverless functions (e.g.,api/index.js) to be emitted underdist/api/.scripts/bundle-api.mjs) outputsapi/index.jsat the project root, not underdist/.Why the recent code changes (PR #1001) did not help
@hono/node-server/vercel's recommendedhandle()function but did not address the output path mismatch.dist/.Evidence
vercel.json:Steps to reproduce
mainbranch to Vercel./api/v1/metaor any/api/*endpoint.Severity
What needs to be fixed
outfile:inbundle-api.mjstodist/api/index.js.functionsconfig to be explicit about the function entrypoint.dist/api/.Acceptance Criteria
/api/*endpoints when API is present./cc @hotlong