Skip to content

Commit 2f44d3e

Browse files
authored
Merge pull request #1035 from objectstack-ai/copilot/fix-serverless-function-pattern
2 parents 1368a4a + a94446b commit 2f44d3e

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

apps/studio/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@
4848

4949
### Fixes
5050

51+
- **Vercel deployment: Fix `functions` pattern validation error**
52+
- The `functions` key in `vercel.json` referenced `api/index.js` — a build artifact created by
53+
`bundle-api.mjs` — which does not exist in the source tree. Vercel CLI validates patterns against
54+
source files before the build runs, producing the error:
55+
`The pattern "api/index.js" defined in "functions" doesn't match any Serverless Functions`.
56+
- Removed `functions` from `vercel.json` and moved the memory/maxDuration settings to an inline
57+
`export const config` in `server/index.ts`. This is the standard Vercel per-function configuration
58+
mechanism and is bundled into `api/index.js` by esbuild.
59+
5160
- **Vercel deployment: Fix `@vercel/node@3` runtime error**
5261
- Removed the `functions.runtime` config from `vercel.json` — the `runtime` field is only for custom/community runtimes, not Node.js. Vercel auto-detects the pre-bundled `api/index.js` as a Node.js serverless function.
5362

apps/studio/server/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,15 @@ app.all('*', async (c) => {
235235
});
236236

237237
export default handle(app);
238+
239+
/**
240+
* Vercel per-function configuration.
241+
*
242+
* Picked up by the @vercel/node runtime from the deployed api/index.js bundle.
243+
* Replaces the top-level "functions" key in vercel.json so there is no
244+
* pre-build file-pattern validation against a not-yet-bundled artifact.
245+
*/
246+
export const config = {
247+
memory: 1024,
248+
maxDuration: 60,
249+
};

apps/studio/vercel.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
"VITE_SERVER_URL": "https://play.objectstack.ai"
1111
}
1212
},
13-
"functions": {
14-
"api/index.js": {
15-
"memory": 1024,
16-
"maxDuration": 60
17-
}
18-
},
1913
"rewrites": [
2014
{ "source": "/api/(.*)", "destination": "/api" },
2115
{ "source": "/((?!api/).*)", "destination": "/index.html" }

0 commit comments

Comments
 (0)