Skip to content

Commit 8805506

Browse files
fix: configure Vercel to serve API routes as serverless functions instead of HTML
- Add outputDirectory: "public" to vercel.json - Add functions block declaring api/index.js as serverless function - Fix API rewrite destination from /api to /api/index.js - Update CHANGELOG.md Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/d0116abe-0010-46e2-a25d-08bc5236156b Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 0fbdd7e commit 8805506

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Fixed
11+
- **Studio Vercel API routes returning HTML instead of JSON** — Updated
12+
`apps/studio/vercel.json` to correctly configure Vercel serverless functions.
13+
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.
1117
- **Client test aligned with removed `ai.chat` method** — Updated
1218
`@objectstack/client` test suite to match the current API surface where
1319
`ai.chat()` was removed in favour of the Vercel AI SDK `useChat()` hook.

apps/studio/vercel.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
"framework": null,
44
"installCommand": "cd ../.. && pnpm install",
55
"buildCommand": "bash scripts/build-vercel.sh",
6+
"outputDirectory": "public",
7+
"functions": {
8+
"api/index.js": {
9+
"memory": 1024,
10+
"maxDuration": 60
11+
}
12+
},
613
"build": {
714
"env": {
815
"VITE_RUNTIME_MODE": "server",
@@ -18,7 +25,7 @@
1825
}
1926
],
2027
"rewrites": [
21-
{ "source": "/api/(.*)", "destination": "/api" },
28+
{ "source": "/api/(.*)", "destination": "/api/index.js" },
2229
{ "source": "/((?!api/).*)", "destination": "/index.html" }
2330
]
2431
}

0 commit comments

Comments
 (0)