Skip to content

Commit 399f602

Browse files
Copilothotlong
andauthored
fix: remove functions block from vercel.json to fix pre-build validation error
The `functions` block pattern `api/index.js` fails Vercel's pre-build validation because the file is generated during the build step (by bundle-api.mjs), not available beforehand. The in-code `export const config` in server/index.ts already configures memory and maxDuration — Vercel's @vercel/node runtime picks it up from the deployed function bundle without any vercel.json pattern matching. Also reverts the rewrite destination to `/api` (the auto-detected route for api/index.js) instead of `/api/index.js` (a file path that doesn't map to a Vercel route). Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/16819ebf-4d21-4ae9-892d-8c1593b21504 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent e95f3a9 commit 399f602

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- **Studio Vercel API routes returning HTML instead of JSON** — Updated
1212
`apps/studio/vercel.json` to correctly configure Vercel serverless functions.
1313
Added `outputDirectory: "public"` so Vercel serves static files from the
14-
correct directory, declared `api/index.js` in the `functions` block so Vercel
15-
recognises it as a serverless function, and changed the API rewrite destination
16-
from `/api` to `/api/index.js` to route requests to the bundled handler.
14+
correct directory and the `api/` directory is auto-detected for serverless
15+
functions. Removed the `functions` block (the in-code `export const config`
16+
in `server/index.ts` already configures memory/maxDuration without pre-build
17+
file-pattern validation errors).
1718
- **Studio CORS error on Vercel temporary/preview domains** — Added Hono CORS
1819
middleware to `apps/studio/server/index.ts` so the serverless function returns
1920
correct `Access-Control-Allow-Origin` headers for cross-origin requests.

apps/studio/vercel.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
"installCommand": "cd ../.. && pnpm install",
55
"buildCommand": "bash scripts/build-vercel.sh",
66
"outputDirectory": "public",
7-
"functions": {
8-
"api/index.js": {
9-
"memory": 1024,
10-
"maxDuration": 60
11-
}
12-
},
137
"build": {
148
"env": {
159
"VITE_RUNTIME_MODE": "server",
@@ -25,7 +19,7 @@
2519
}
2620
],
2721
"rewrites": [
28-
{ "source": "/api/(.*)", "destination": "/api/index.js" },
22+
{ "source": "/api/(.*)", "destination": "/api" },
2923
{ "source": "/((?!api/).*)", "destination": "/index.html" }
3024
]
3125
}

0 commit comments

Comments
 (0)