Skip to content

fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, fix TypeScript errors in API route, and fix pnpm symlinks#428

Merged
hotlong merged 10 commits intomainfrom
copilot/update-node-version-warning
Mar 21, 2026
Merged

fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, fix TypeScript errors in API route, and fix pnpm symlinks#428
hotlong merged 10 commits intomainfrom
copilot/update-node-version-warning

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

Vercel builds were failing due to cascading issues in apps/demo/scripts/build-vercel.sh, example package build scripts, the missing Vercel output directory, TypeScript errors in the serverless function entry point, and pnpm symlinks preventing the serverless function from being deployed.

Changes

  • apps/demo/scripts/build-vercel.sh — reordered build steps to respect the actual dependency graph:
Before:  types → core ✗ → platform-node → driver-memory → plugins
After:   types → plugin-optimizations → plugins → core ✓ → platform-node → drivers → protocols → examples

@objectql/core/src/plugin.ts statically imports from all three plugin packages, so they must be compiled first. @objectql/plugin-optimizations is added as an explicit step before the other plugins since @objectql/plugin-query depends on it.

  • apps/demo/scripts/build-vercel.sh — added @objectql/driver-sql alongside @objectql/driver-memory in the drivers build step. @objectql/example-project-tracker/src/seed.ts imports SqlDriver from @objectql/driver-sql, which must be compiled before the example is built.

  • examples/showcase/project-tracker/package.json and examples/showcase/enterprise-erp/package.json — replaced rsync -a --include '*.yml' ... (unavailable on Vercel's build image) with an equivalent Node.js inline script that recursively copies .yml files from src/ to dist/ preserving directory structure, with no external tool dependencies.

  • apps/demo/public/.gitkeep and apps/demo/scripts/build-vercel.sh — added the public output directory required by Vercel when "framework": null is set. Vercel defaults to looking for a public directory after the build completes. Added apps/demo/public/.gitkeep to track the directory in git, and added mkdir -p public at the end of the build script as a safety measure.

  • apps/demo/package.json, pnpm-lock.yaml, and apps/demo/api/[[...route]].ts — fixed four TypeScript errors surfaced by Vercel's function bundler:

    • Added @objectstack/runtime and @objectstack/driver-memory as explicit direct dependencies (^3.2.8) in apps/demo/package.json and pnpm-lock.yaml. These packages were imported by api/[[...route]].ts but were only available as transitive dependencies, causing TS2307 module-not-found errors.
    • Fixed TS2322: Type 'Buffer' is not assignable to type 'BodyInit' by converting the Node.js Buffer to an ArrayBuffer via .buffer.slice(byteOffset, byteOffset + byteLength). ArrayBuffer is always present in BodyInit regardless of the TypeScript lib target, unlike Uint8Array which is absent in the ES2019 lib used by Vercel's bundler.
    • Fixed TS2353: 'secret' does not exist in type 'AuthPluginOptions' by casting the options object as any. The secret property is correct at runtime (used identically throughout the codebase), but the @objectstack/plugin-auth@3.2.8 type definition does not include it.
  • apps/demo/package.json and apps/demo/scripts/patch-symlinks.cjs — fixed the "invalid deployment package … symlinked directories" error via a postinstall lifecycle hook. Vercel's build pipeline runs two separate pnpm install passes: the installCommand (pnpm install --ignore-scripts, which skips lifecycle scripts) and an automatic second install after buildCommand completes (without --ignore-scripts, which runs lifecycle scripts and recreates all pnpm symlinks). The previous node-linker=hoisted approach was reverted because it caused pnpm to create apps/demo/node_modules/@objectstack/core as a symlink to the root's physical copy, which TypeScript resolves as a second module instance and reports TS2345 — Types have separate declarations of private property 'plugins'. The correct fix is a postinstall script (node scripts/patch-symlinks.cjs) in apps/demo/package.json that runs after the second install (the right timing window, just before Vercel's TypeScript bundler). patch-symlinks.cjs is guarded with if (!process.env.VERCEL) { process.exit(0) } so it is a no-op in local development (preserving pnpm workspace symlinks for live-reload) and only activates during Vercel builds where VERCEL=1.

  • apps/demo/vercel.json — updated includeFiles to remove packages/*/dist (was evaluated relative to apps/demo/ and matched nothing) and add node_modules/@objectql/example-project-tracker/dist which after the postinstall patch is a physical directory containing the compiled project-tracker metadata, required for the serverless function's runtime dynamic import.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 21, 2026

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

Project Deployment Actions Updated (UTC)
objectql Ready Ready Preview, Comment Mar 21, 2026 5:16am
objectql-demo Ready Ready Preview, Comment Mar 21, 2026 5:16am

Request Review

Copilot AI changed the title [WIP] Update package.json for node version management fix: correct build order in build-vercel.sh — build plugins before @objectql/core Mar 21, 2026
Copilot AI requested a review from hotlong March 21, 2026 03:26
@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 11:25:47.047 Running build in Washington, D.C., USA (East) – iad1
11:25:47.048 Build machine configuration: 4 cores, 8 GB
11:25:47.200 Cloning github.com/objectstack-ai/objectql (Branch: copilot/update-node-version-warning, Commit: b3ee6ce)
11:25:47.201 Previous build caches not available.
11:25:47.670 Cloning completed: 470.000ms
11:25:49.257 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
11:25:49.258 Running "vercel build"
11:25:49.920 Vercel CLI 50.34.2
11:25:49.992 > Detected Turbo. Adjusting default settings...
11:25:50.541 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
11:25:50.612 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
11:25:50.612 Running "install" command: pnpm install --ignore-scripts...
11:25:52.719 Scope: all 42 workspace projects
11:25:52.911 ../.. | Progress: resolved 1, reused 0, downloaded 0, added 0
11:25:53.047 ../.. | +1533 ++++++++++++++++++++++++++++
11:25:53.912 ../.. | Progress: resolved 1533, reused 0, downloaded 41, added 14
11:25:54.914 ../.. | Progress: resolved 1533, reused 0, downloaded 152, added 65
11:25:55.914 ../.. | Progress: resolved 1533, reused 0, downloaded 252, added 102
11:25:56.917 ../.. | Progress: resolved 1533, reused 0, downloaded 422, added 231
11:25:57.926 ../.. | Progress: resolved 1533, reused 0, downloaded 612, added 320
11:25:58.927 ../.. | Progress: resolved 1533, reused 0, downloaded 841, added 452
11:25:59.927 ../.. | Progress: resolved 1533, reused 0, downloaded 1011, added 560
11:26:00.927 ../.. | Progress: resolved 1533, reused 0, downloaded 1241, added 693
11:26:01.931 ../.. | Progress: resolved 1533, reused 0, downloaded 1422, added 788
11:26:02.932 ../.. | Progress: resolved 1533, reused 0, downloaded 1528, added 934
11:26:03.932 ../.. | Progress: resolved 1533, reused 0, downloaded 1528, added 1220
11:26:04.933 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1486
11:26:05.935 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1532
11:26:05.953 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1533, done
11:26:06.752
11:26:06.752 devDependencies:
11:26:06.752 + @hono/node-server 1.19.11
11:26:06.753 + @object-ui/console 3.1.3
11:26:06.753 + @objectql/core 4.2.2 <- ../../packages/foundation/core
11:26:06.753 + @objectql/driver-memory 4.2.2 <- ../../packages/drivers/memory
11:26:06.753 + @objectql/example-project-tracker 4.2.2 <- ../../examples/showcase/project-tracker
11:26:06.753 + @objectql/platform-node 4.2.2 <- ../../packages/foundation/platform-node
11:26:06.753 + @objectql/plugin-formula 4.2.2 <- ../../packages/foundation/plugin-formula
11:26:06.753 + @objectql/plugin-query 4.2.2 <- ../../packages/foundation/plugin-query
11:26:06.753 + @objectql/plugin-security 4.2.2 <- ../../packages/foundation/plugin-security
11:26:06.753 + @objectql/plugin-validator 4.2.2 <- ../../packages/foundation/plugin-validator
11:26:06.753 + @objectql/protocol-graphql 4.2.2 <- ../../packages/protocols/graphql
11:26:06.753 + @objectql/protocol-json-rpc 4.2.2 <- ../../packages/protocols/json-rpc
11:26:06.753 + @objectql/protocol-odata-v4 4.2.2 <- ../../packages/protocols/odata-v4
11:26:06.754 + @objectql/types 4.2.2 <- ../../packages/foundation/types
11:26:06.754 + @objectstack/cli 3.2.8
11:26:06.754 + @objectstack/core 3.2.8
11:26:06.754 + @objectstack/objectql 3.2.8
11:26:06.754 + @objectstack/plugin-auth 3.2.8
11:26:06.754 + @objectstack/plugin-hono-server 3.2.8
11:26:06.754 + @objectstack/studio 3.2.8
11:26:06.754 + @types/node 20.19.37
11:26:06.754 + hono 4.12.8
11:26:06.754 + typescript 5.9.3
11:26:06.754
11:26:06.762 Done in 14.4s using pnpm v10.28.2
11:26:06.906 ▸ Building @objectql/types…
11:26:07.555
11:26:07.555 > @objectql/types@4.2.2 build /vercel/path0/packages/foundation/types
11:26:07.555 > tsc
11:26:07.555
11:26:09.992 ▸ Building @objectql/plugin-optimizations…
11:26:10.612
11:26:10.612 > @objectql/plugin-optimizations@4.2.2 build /vercel/path0/packages/foundation/plugin-optimizations
11:26:10.612 > tsc
11:26:10.612
11:26:12.686 ▸ Building plugins…
11:26:13.306 Scope: 4 of 42 workspace projects
11:26:13.309 ../../packages/foundation/plugin-query build$ tsc
11:26:13.310 .../packages/foundation/plugin-validator build$ tsc
11:26:13.311 ../../packages/foundation/plugin-formula build$ tsc
11:26:13.311 .../packages/foundation/plugin-security build$ tsc
11:26:18.724 ../../packages/foundation/plugin-formula build: Done
11:26:18.858 .../packages/foundation/plugin-validator build: Done
11:26:18.901 ../../packages/foundation/plugin-query build: Done
11:26:19.123 .../packages/foundation/plugin-security build: Done
11:26:19.136 ▸ Building @objectql/core…
11:26:19.771
11:26:19.772 > @objectql/core@4.2.2 build /vercel/path0/packages/foundation/core
11:26:19.772 > tsc
11:26:19.772
11:26:22.017 ▸ Building @objectql/platform-node…
11:26:22.681
11:26:22.681 > @objectql/platform-node@4.2.2 build /vercel/path0/packages/foundation/platform-node
11:26:22.681 > tsc
11:26:22.681
11:26:24.750 ▸ Building drivers…
11:26:25.379
11:26:25.380 > @objectql/driver-memory@4.2.2 build /vercel/path0/packages/drivers/memory
11:26:25.380 > tsc
11:26:25.380
11:26:27.458 ▸ Building protocols…
11:26:28.080 Scope: 3 of 42 workspace projects
11:26:28.084 ../../packages/protocols/graphql build$ tsc
11:26:28.085 ../../packages/protocols/odata-v4 build$ tsc
11:26:28.085 ../../packages/protocols/json-rpc build$ tsc
11:26:32.244 ../../packages/protocols/json-rpc build: Done
11:26:32.336 ../../packages/protocols/odata-v4 build: Done
11:26:32.572 ../../packages/protocols/graphql build: Done
11:26:32.585 ▸ Building project-tracker example…
11:26:33.224
11:26:33.224 > @objectql/example-project-tracker@4.2.2 build /vercel/path0/examples/showcase/project-tracker
11:26:33.225 > tsc && rsync -a --include '/' --include '.yml' --exclude '*' src/ dist/
11:26:33.225
11:26:35.246 src/seed.ts(10,27): error TS2307: Cannot find module '@objectql/driver-sql' or its corresponding type declarations.
11:26:35.283 /vercel/path0/examples/showcase/project-tracker:
11:26:35.283  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @objectql/example-project-tracker@4.2.2 build: tsc && rsync -a --include '*/' --include '*.yml' --exclude '*' src/ dist/
11:26:35.283 Exit status 2
11:26:35.303 Error: Command "bash scripts/build-vercel.sh" exited with 2

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 11:25:47.047 Running build in Washington, D.C., USA (East) – iad1
11:25:47.048 Build machine configuration: 4 cores, 8 GB
11:25:47.200 Cloning github.com/objectstack-ai/objectql (Branch: co...

The new failure was @objectql/driver-sql not being built before the project-tracker example — seed.ts imports SqlDriver from that package. Fixed in e629a5a by adding @objectql/driver-sql to the drivers build step alongside @objectql/driver-memory.

@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 11:34:07.987 Running build in Washington, D.C., USA (East) – iad1
11:34:07.988 Build machine configuration: 4 cores, 8 GB
11:34:08.206 Cloning github.com/objectstack-ai/objectql (Branch: copilot/update-node-version-warning, Commit: e629a5a)
11:34:08.207 Previous build caches not available.
11:34:08.675 Cloning completed: 469.000ms
11:34:09.270 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
11:34:09.270 Running "vercel build"
11:34:09.907 Vercel CLI 50.34.2
11:34:09.981 > Detected Turbo. Adjusting default settings...
11:34:10.545 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
11:34:10.621 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
11:34:10.621 Running "install" command: pnpm install --ignore-scripts...
11:34:12.942 Scope: all 42 workspace projects
11:34:13.140 ../.. | Progress: resolved 1, reused 0, downloaded 0, added 0
11:34:13.293 ../.. | +1533 ++++++++++++++++++++++++++++
11:34:14.141 ../.. | Progress: resolved 1533, reused 0, downloaded 47, added 18
11:34:15.188 ../.. | Progress: resolved 1533, reused 0, downloaded 148, added 55
11:34:16.188 ../.. | Progress: resolved 1533, reused 0, downloaded 257, added 104
11:34:17.189 ../.. | Progress: resolved 1533, reused 0, downloaded 435, added 207
11:34:18.189 ../.. | Progress: resolved 1533, reused 0, downloaded 618, added 298
11:34:19.202 ../.. | Progress: resolved 1533, reused 0, downloaded 847, added 439
11:34:20.203 ../.. | Progress: resolved 1533, reused 0, downloaded 1017, added 564
11:34:21.204 ../.. | Progress: resolved 1533, reused 0, downloaded 1226, added 677
11:34:22.206 ../.. | Progress: resolved 1533, reused 0, downloaded 1414, added 777
11:34:23.206 ../.. | Progress: resolved 1533, reused 0, downloaded 1528, added 856
11:34:24.207 ../.. | Progress: resolved 1533, reused 0, downloaded 1528, added 1081
11:34:25.207 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1468
11:34:26.207 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1532
11:34:26.231 ../.. | Progress: resolved 1533, reused 0, downloaded 1529, added 1533, done
11:34:27.151
11:34:27.151 devDependencies:
11:34:27.151 + @hono/node-server 1.19.11
11:34:27.151 + @object-ui/console 3.1.3
11:34:27.151 + @objectql/core 4.2.2 <- ../../packages/foundation/core
11:34:27.151 + @objectql/driver-memory 4.2.2 <- ../../packages/drivers/memory
11:34:27.151 + @objectql/example-project-tracker 4.2.2 <- ../../examples/showcase/project-tracker
11:34:27.151 + @objectql/platform-node 4.2.2 <- ../../packages/foundation/platform-node
11:34:27.151 + @objectql/plugin-formula 4.2.2 <- ../../packages/foundation/plugin-formula
11:34:27.152 + @objectql/plugin-query 4.2.2 <- ../../packages/foundation/plugin-query
11:34:27.152 + @objectql/plugin-security 4.2.2 <- ../../packages/foundation/plugin-security
11:34:27.152 + @objectql/plugin-validator 4.2.2 <- ../../packages/foundation/plugin-validator
11:34:27.152 + @objectql/protocol-graphql 4.2.2 <- ../../packages/protocols/graphql
11:34:27.152 + @objectql/protocol-json-rpc 4.2.2 <- ../../packages/protocols/json-rpc
11:34:27.152 + @objectql/protocol-odata-v4 4.2.2 <- ../../packages/protocols/odata-v4
11:34:27.152 + @objectql/types 4.2.2 <- ../../packages/foundation/types
11:34:27.152 + @objectstack/cli 3.2.8
11:34:27.152 + @objectstack/core 3.2.8
11:34:27.152 + @objectstack/objectql 3.2.8
11:34:27.152 + @objectstack/plugin-auth 3.2.8
11:34:27.152 + @objectstack/plugin-hono-server 3.2.8
11:34:27.152 + @objectstack/studio 3.2.8
11:34:27.152 + @types/node 20.19.37
11:34:27.152 + hono 4.12.8
11:34:27.152 + typescript 5.9.3
11:34:27.152
11:34:27.162 Done in 14.6s using pnpm v10.28.2
11:34:31.894 ▸ Building @objectql/types…
11:34:32.561
11:34:32.562 > @objectql/types@4.2.2 build /vercel/path0/packages/foundation/types
11:34:32.562 > tsc
11:34:32.562
11:34:35.113 ▸ Building @objectql/plugin-optimizations…
11:34:35.758
11:34:35.758 > @objectql/plugin-optimizations@4.2.2 build /vercel/path0/packages/foundation/plugin-optimizations
11:34:35.758 > tsc
11:34:35.758
11:34:37.907 ▸ Building plugins…
11:34:38.557 Scope: 4 of 42 workspace projects
11:34:38.561 ../../packages/foundation/plugin-query build$ tsc
11:34:38.561 ../../packages/foundation/plugin-formula build$ tsc
11:34:38.562 .../packages/foundation/plugin-validator build$ tsc
11:34:38.562 .../packages/foundation/plugin-security build$ tsc
11:34:44.226 .../packages/foundation/plugin-validator build: Done
11:34:44.288 ../../packages/foundation/plugin-query build: Done
11:34:44.413 ../../packages/foundation/plugin-formula build: Done
11:34:44.486 .../packages/foundation/plugin-security build: Done
11:34:44.500 ▸ Building @objectql/core…
11:34:45.143
11:34:45.143 > @objectql/core@4.2.2 build /vercel/path0/packages/foundation/core
11:34:45.143 > tsc
11:34:45.143
11:34:47.399 ▸ Building @objectql/platform-node…
11:34:48.046
11:34:48.046 > @objectql/platform-node@4.2.2 build /vercel/path0/packages/foundation/platform-node
11:34:48.046 > tsc
11:34:48.046
11:34:50.161 ▸ Building drivers…
11:34:50.798 Scope: 2 of 42 workspace projects
11:34:50.802 ../../packages/drivers/memory build$ tsc
11:34:50.803 ../../packages/drivers/sql build$ tsc
11:34:53.788 ../../packages/drivers/memory build: Done
11:34:54.046 ../../packages/drivers/sql build: Done
11:34:54.060 ▸ Building protocols…
11:34:54.693 Scope: 3 of 42 workspace projects
11:34:54.696 ../../packages/protocols/graphql build$ tsc
11:34:54.697 ../../packages/protocols/json-rpc build$ tsc
11:34:54.698 ../../packages/protocols/odata-v4 build$ tsc
11:34:58.992 ../../packages/protocols/json-rpc build: Done
11:34:59.061 ../../packages/protocols/odata-v4 build: Done
11:34:59.178 ../../packages/protocols/graphql build: Done
11:34:59.192 ▸ Building project-tracker example…
11:34:59.837
11:34:59.837 > @objectql/example-project-tracker@4.2.2 build /vercel/path0/examples/showcase/project-tracker
11:34:59.837 > tsc && rsync -a --include '/' --include '.yml' --exclude '*' src/ dist/
11:34:59.837
11:35:01.976 sh: line 1: rsync: command not found
11:35:01.992 /vercel/path0/examples/showcase/project-tracker:
11:35:01.992  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @objectql/example-project-tracker@4.2.2 build: tsc && rsync -a --include '*/' --include '*.yml' --exclude '*' src/ dist/
11:35:01.992 spawn ENOENT
11:35:02.012 Error: Command "bash scripts/build-vercel.sh" exited with 1

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 11:34:07.987 Running build in Washington, D.C., USA (East) – iad1
11:34:07.988 Build machine configuration: 4 cores, 8 GB
11:34:08.206 Cloning github.com/objectstack-ai/objectql (Branch: co...

Fixed in 4d3a18d. Vercel's build image doesn't include rsync, so the tsc && rsync ... build command in examples/showcase/project-tracker/package.json (and enterprise-erp/package.json) was replaced with an equivalent Node.js inline script that copies .yml files preserving directory structure — no external tools required.

Copilot AI changed the title fix: correct build order in build-vercel.sh — build plugins before @objectql/core fix: fix Vercel build — correct build order, add missing drivers, and remove rsync dependency Mar 21, 2026
@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 11:45:43.861 Error: No Output Directory named "public" found after the Build completed. Update vercel.json#outputDirectory to ensure the correct output directory is generated.

@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 12:17:08.350 Running build in Washington, D.C., USA (East) – iad1
12:17:08.351 Build machine configuration: 4 cores, 8 GB
12:17:08.475 Cloning github.com/objectstack-ai/objectql (Branch: copilot/update-node-version-warning, Commit: 8b2f70a)
12:17:09.216 Cloning completed: 741.000ms
12:17:10.186 Restored build cache from previous deployment (C6wUgryVyvK58HcbWzm99JCWmdfe)
12:17:10.574 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:17:10.574 Running "vercel build"
12:17:11.171 Vercel CLI 50.34.2
12:17:11.246 > Detected Turbo. Adjusting default settings...
12:17:11.774 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:17:11.846 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
12:17:11.846 Running "install" command: pnpm install --ignore-scripts...
12:17:13.922 Scope: all 42 workspace projects
12:17:15.347
12:17:15.354 Done in 1.8s using pnpm v10.28.2
12:17:15.474 ▸ Building @objectql/types…
12:17:16.102
12:17:16.103 > @objectql/types@4.2.2 build /vercel/path0/packages/foundation/types
12:17:16.103 > tsc
12:17:16.103
12:17:18.722 ▸ Building @objectql/plugin-optimizations…
12:17:19.372
12:17:19.372 > @objectql/plugin-optimizations@4.2.2 build /vercel/path0/packages/foundation/plugin-optimizations
12:17:19.372 > tsc
12:17:19.373
12:17:21.519 ▸ Building plugins…
12:17:22.152 Scope: 4 of 42 workspace projects
12:17:22.156 ../../packages/foundation/plugin-query build$ tsc
12:17:22.156 .../packages/foundation/plugin-validator build$ tsc
12:17:22.157 ../../packages/foundation/plugin-formula build$ tsc
12:17:22.157 .../packages/foundation/plugin-security build$ tsc
12:17:27.657 ../../packages/foundation/plugin-formula build: Done
12:17:27.713 .../packages/foundation/plugin-validator build: Done
12:17:27.748 ../../packages/foundation/plugin-query build: Done
12:17:27.871 .../packages/foundation/plugin-security build: Done
12:17:27.884 ▸ Building @objectql/core…
12:17:28.519
12:17:28.519 > @objectql/core@4.2.2 build /vercel/path0/packages/foundation/core
12:17:28.519 > tsc
12:17:28.519
12:17:30.758 ▸ Building @objectql/platform-node…
12:17:31.392
12:17:31.392 > @objectql/platform-node@4.2.2 build /vercel/path0/packages/foundation/platform-node
12:17:31.392 > tsc
12:17:31.392
12:17:33.472 ▸ Building drivers…
12:17:34.104 Scope: 2 of 42 workspace projects
12:17:34.108 ../../packages/drivers/memory build$ tsc
12:17:34.109 ../../packages/drivers/sql build$ tsc
12:17:37.015 ../../packages/drivers/memory build: Done
12:17:37.374 ../../packages/drivers/sql build: Done
12:17:37.386 ▸ Building protocols…
12:17:38.018 Scope: 3 of 42 workspace projects
12:17:38.022 ../../packages/protocols/graphql build$ tsc
12:17:38.023 ../../packages/protocols/json-rpc build$ tsc
12:17:38.023 ../../packages/protocols/odata-v4 build$ tsc
12:17:42.265 ../../packages/protocols/json-rpc build: Done
12:17:42.422 ../../packages/protocols/odata-v4 build: Done
12:17:42.477 ../../packages/protocols/graphql build: Done
12:17:42.489 ▸ Building project-tracker example…
12:17:43.126
12:17:43.126 > @objectql/example-project-tracker@4.2.2 build /vercel/path0/examples/showcase/project-tracker
12:17:43.126 > tsc && node -e "const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')"
12:17:43.126
12:17:45.262 ▸ Patching pnpm symlinks for Vercel…
12:17:45.285
12:17:45.286 🔧 Patching pnpm symlinks for Vercel deployment…
12:17:45.286
12:17:45.286 → Dereferencing node_modules/@hono/node-server
12:17:45.292 → Dereferencing node_modules/@object-ui/console
12:17:45.315 → Dereferencing node_modules/@objectql/core
12:17:45.317 → Dereferencing node_modules/@objectql/driver-memory
12:17:45.319 → Dereferencing node_modules/@objectql/example-project-tracker
12:17:45.322 → Dereferencing node_modules/@objectql/platform-node
12:17:45.324 → Dereferencing node_modules/@objectql/plugin-formula
12:17:45.326 → Dereferencing node_modules/@objectql/plugin-query
12:17:45.328 → Dereferencing node_modules/@objectql/plugin-security
12:17:45.331 → Dereferencing node_modules/@objectql/plugin-validator
12:17:45.332 → Dereferencing node_modules/@objectql/protocol-graphql
12:17:45.334 → Dereferencing node_modules/@objectql/protocol-json-rpc
12:17:45.336 → Dereferencing node_modules/@objectql/protocol-odata-v4
12:17:45.338 → Dereferencing node_modules/@objectql/types
12:17:45.344 → Dereferencing node_modules/@objectstack/cli
12:17:45.357 → Dereferencing node_modules/@objectstack/core
12:17:45.365 → Dereferencing node_modules/@objectstack/driver-memory
12:17:45.369 → Dereferencing node_modules/@objectstack/objectql
12:17:45.373 → Dereferencing node_modules/@objectstack/plugin-auth
12:17:45.381 → Dereferencing node_modules/@objectstack/plugin-hono-server
12:17:45.383 → Dereferencing node_modules/@objectstack/runtime
12:17:45.387 → Dereferencing node_modules/@objectstack/studio
12:17:45.396 → Dereferencing node_modules/@types/node
12:17:45.400 → Dereferencing node_modules/hono
12:17:45.441 → Dereferencing node_modules/typescript
12:17:45.487
12:17:45.488 ✅ Patch complete — processed 48 packages
12:17:45.488
12:17:45.493 ✓ Vercel build complete.
12:17:45.507 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:17:45.568 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
12:17:45.599 Installing dependencies...
12:17:46.234 Scope: all 42 workspace projects
12:17:47.555
12:17:47.555 devDependencies:
12:17:47.555 + @hono/node-server 1.19.11
12:17:47.555 + @object-ui/console 3.1.3
12:17:47.555 + @objectql/core 4.2.2 <- ../../packages/foundation/core
12:17:47.555 + @objectql/driver-memory 4.2.2 <- ../../packages/drivers/memory
12:17:47.555 + @objectql/example-project-tracker 4.2.2 <- ../../examples/showcase/project-tracker
12:17:47.555 + @objectql/platform-node 4.2.2 <- ../../packages/foundation/platform-node
12:17:47.555 + @objectql/plugin-formula 4.2.2 <- ../../packages/foundation/plugin-formula
12:17:47.555 + @objectql/plugin-query 4.2.2 <- ../../packages/foundation/plugin-query
12:17:47.556 + @objectql/plugin-security 4.2.2 <- ../../packages/foundation/plugin-security
12:17:47.556 + @objectql/plugin-validator 4.2.2 <- ../../packages/foundation/plugin-validator
12:17:47.556 + @objectql/protocol-graphql 4.2.2 <- ../../packages/protocols/graphql
12:17:47.556 + @objectql/protocol-json-rpc 4.2.2 <- ../../packages/protocols/json-rpc
12:17:47.556 + @objectql/protocol-odata-v4 4.2.2 <- ../../packages/protocols/odata-v4
12:17:47.556 + @objectql/types 4.2.2 <- ../../packages/foundation/types
12:17:47.556 + @objectstack/cli 3.2.8
12:17:47.556 + @objectstack/core 3.2.8
12:17:47.556 + @objectstack/driver-memory 3.2.8
12:17:47.556 + @objectstack/objectql 3.2.8
12:17:47.556 + @objectstack/plugin-auth 3.2.8
12:17:47.556 + @objectstack/plugin-hono-server 3.2.8
12:17:47.556 + @objectstack/runtime 3.2.8
12:17:47.556 + @objectstack/studio 3.2.8
12:17:47.556 + @types/node 20.19.37
12:17:47.556 + hono 4.12.8
12:17:47.556 + typescript 5.9.3
12:17:47.557
12:17:47.570 ../site postinstall$ fumadocs-mdx
12:17:47.971 ../site postinstall: [MDX] generated files in 19.899470000000008ms
12:17:47.978 ../site postinstall: Done
12:17:48.094 Done in 2.1s using pnpm v10.28.2
12:17:48.419 Using TypeScript 5.9.3 (local user-provided)
12:17:57.792 Build Completed in /vercel/output [46s]
12:17:58.420 Deploying outputs...
12:17:59.524 Warning: Provided memory setting in vercel.json is ignored on Active CPU billing. You can safely remove this setting from your configuration. Learn more: https://vercel.com/docs/fluid-compute/pricing
12:18:03.755 The framework produced an invalid deployment package for a Serverless Function. Typically this means that the framework produces files in symlinked directories. Please verify the framework settings.
12:18:06.218 Creating build cache...
12:19:14.934 Created build cache: 1m
12:19:14.934 Uploading build cache [228.08 MB]
12:19:17.836 Build cache uploaded: 2.901s

…serverless bundling

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/4ce080f7-77be-4e30-94b4-10cf3d7fdb63
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 12:17:08.350 Running build in Washington, D.C., USA (East) – iad1
12:17:08.351 Build machine configuration: 4 cores, 8 GB
12:17:08.475 Cloning github.com/objectstack-ai/objectql (Branch: co...

Fixed in 8da7910. The build completed successfully but the deployment failed because fs.cpSync in patch-symlinks.cjs was copying without dereference: true — meaning symlinks inside each top-level package (pnpm's nested .pnpm-store references) were preserved as symlinks in the copy. Added dereference: true so all nested symlinks are fully resolved to real files before Vercel bundles the serverless function.

Copilot AI changed the title fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, and fix TypeScript errors in API route fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, fix TypeScript errors in API route, and fix pnpm symlink dereferencing Mar 21, 2026
@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 12:30:26.618 The framework produced an invalid deployment package for a Serverless Function. Typically this means that the framework produces files in symlinked directories. Please verify the framework settings.

… Vercel deployment

Vercel runs a second pnpm install after our buildCommand completes, which
re-creates pnpm symlinks before the TypeScript function bundler runs. The
previous patch-symlinks.cjs approach was ineffective because it only patched
during our build step, not after Vercel's own re-install.

Add node-linker=hoisted to root .npmrc so pnpm uses a flat node_modules layout
(no symlinks for registry packages) in both install steps. Remove the
now-ineffective patch-symlinks.cjs call from build-vercel.sh.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/5c27ebc5-c40a-4756-8482-8f4c6c797208
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 12:30:26.618 The framework produced an invalid deployment package for a Serverless Function. Typically this means that the framework produces files in symlinked directories. Please verify the...

Fixed in 3662ad9.

The root cause was a Vercel build-pipeline ordering issue: Vercel runs a second pnpm install after our buildCommand completes (visible at 12:17:45.599 in the log), which re-creates all pnpm symlinks before the TypeScript function bundler runs. The patch-symlinks.cjs approach was being undone by this re-install every time.

The fix: added node-linker=hoisted to the root .npmrc. With this setting, pnpm uses a flat node_modules layout (no symlinks for registry packages like @objectstack/plugin-auth, @objectstack/studio, @object-ui/console) in both install steps — our installCommand and Vercel's internal re-install. Since both reads come from the same .npmrc in the repo root, symlinks are never created and the Vercel function bundler can package the output cleanly.

Also removed the now-unnecessary patch-symlinks.cjs call from build-vercel.sh.

Copilot AI changed the title fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, fix TypeScript errors in API route, and fix pnpm symlink dereferencing fix: fix Vercel build — correct build order, add missing drivers, remove rsync dependency, add public output directory, fix TypeScript errors in API route, and fix pnpm symlinks Mar 21, 2026
@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Mar 21, 2026

@copilot 12:47:28.823 Running build in Washington, D.C., USA (East) – iad1
12:47:28.824 Build machine configuration: 4 cores, 8 GB
12:47:28.939 Cloning github.com/objectstack-ai/objectql (Branch: copilot/update-node-version-warning, Commit: 3662ad9)
12:47:29.470 Cloning completed: 531.000ms
12:47:30.491 Restored build cache from previous deployment (H5jSo23G9CmqTNXKSVrfKoahSuWu)
12:47:30.892 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:47:30.892 Running "vercel build"
12:47:31.466 Vercel CLI 50.34.2
12:47:31.540 > Detected Turbo. Adjusting default settings...
12:47:32.062 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:47:32.133 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
12:47:32.133 Running "install" command: pnpm install --ignore-scripts...
12:47:34.232 Scope: all 42 workspace projects
12:47:34.915 ../.. | +1624 -209 ++++++++++++++++++++---
12:47:35.323 ../.. | Progress: resolved 0, reused 0, downloaded 1, added 0
12:47:36.325 ../.. | Progress: resolved 0, reused 0, downloaded 39, added 12
12:47:37.327 ../.. | Progress: resolved 0, reused 0, downloaded 97, added 28
12:47:38.328 ../.. | Progress: resolved 0, reused 0, downloaded 192, added 59
12:47:39.334 ../.. | Progress: resolved 0, reused 0, downloaded 258, added 90
12:47:40.345 ../.. | Progress: resolved 0, reused 0, downloaded 297, added 106
12:47:41.342 ../.. | Progress: resolved 0, reused 0, downloaded 381, added 141
12:47:42.344 ../.. | Progress: resolved 0, reused 0, downloaded 418, added 154
12:47:43.344 ../.. | Progress: resolved 0, reused 0, downloaded 573, added 262
12:47:44.346 ../.. | Progress: resolved 0, reused 0, downloaded 603, added 269
12:47:45.346 ../.. | Progress: resolved 0, reused 0, downloaded 638, added 293
12:47:46.346 ../.. | Progress: resolved 0, reused 0, downloaded 650, added 302
12:47:47.346 ../.. | Progress: resolved 0, reused 0, downloaded 656, added 306
12:47:48.347 ../.. | Progress: resolved 0, reused 0, downloaded 673, added 314
12:47:49.348 ../.. | Progress: resolved 0, reused 0, downloaded 713, added 327
12:47:50.349 ../.. | Progress: resolved 0, reused 0, downloaded 777, added 354
12:47:51.349 ../.. | Progress: resolved 0, reused 0, downloaded 811, added 371
12:47:52.351 ../.. | Progress: resolved 0, reused 0, downloaded 951, added 466
12:47:53.352 ../.. | Progress: resolved 0, reused 0, downloaded 1021, added 513
12:47:54.352 ../.. | Progress: resolved 0, reused 0, downloaded 1085, added 547
12:47:55.355 ../.. | Progress: resolved 0, reused 0, downloaded 1152, added 592
12:47:56.357 ../.. | Progress: resolved 0, reused 0, downloaded 1279, added 673
12:47:57.358 ../.. | Progress: resolved 0, reused 0, downloaded 1465, added 834
12:47:58.358 ../.. | Progress: resolved 0, reused 0, downloaded 1632, added 957
12:47:59.360 ../.. | Progress: resolved 0, reused 0, downloaded 1672, added 1038
12:48:00.361 ../.. | Progress: resolved 0, reused 0, downloaded 1672, added 1155
12:48:01.365 ../.. | Progress: resolved 0, reused 0, downloaded 1672, added 1489
12:48:02.071 ../.. | Progress: resolved 0, reused 0, downloaded 1672, added 1624, done
12:48:02.511
12:48:02.524 Done in 28.7s using pnpm v10.28.2
12:48:02.690 ▸ Building @objectql/types…
12:48:03.319
12:48:03.319 > @objectql/types@4.2.2 build /vercel/path0/packages/foundation/types
12:48:03.319 > tsc
12:48:03.319
12:48:05.923 ▸ Building @objectql/plugin-optimizations…
12:48:06.546
12:48:06.547 > @objectql/plugin-optimizations@4.2.2 build /vercel/path0/packages/foundation/plugin-optimizations
12:48:06.547 > tsc
12:48:06.547
12:48:08.949 ▸ Building plugins…
12:48:09.577 Scope: 4 of 42 workspace projects
12:48:09.580 ../../packages/foundation/plugin-query build$ tsc
12:48:09.581 .../packages/foundation/plugin-validator build$ tsc
12:48:09.582 ../../packages/foundation/plugin-formula build$ tsc
12:48:09.582 .../packages/foundation/plugin-security build$ tsc
12:48:15.815 .../packages/foundation/plugin-validator build: Done
12:48:15.833 ../../packages/foundation/plugin-query build: Done
12:48:15.884 ../../packages/foundation/plugin-formula build: Done
12:48:16.099 .../packages/foundation/plugin-security build: Done
12:48:16.112 ▸ Building @objectql/core…
12:48:16.745
12:48:16.745 > @objectql/core@4.2.2 build /vercel/path0/packages/foundation/core
12:48:16.745 > tsc
12:48:16.745
12:48:19.257 ▸ Building @objectql/platform-node…
12:48:19.887
12:48:19.888 > @objectql/platform-node@4.2.2 build /vercel/path0/packages/foundation/platform-node
12:48:19.888 > tsc
12:48:19.888
12:48:22.247 ▸ Building drivers…
12:48:22.872 Scope: 2 of 42 workspace projects
12:48:22.875 ../../packages/drivers/memory build$ tsc
12:48:22.876 ../../packages/drivers/sql build$ tsc
12:48:26.243 ../../packages/drivers/memory build: Done
12:48:26.473 ../../packages/drivers/sql build: Done
12:48:26.486 ▸ Building protocols…
12:48:27.123 Scope: 3 of 42 workspace projects
12:48:27.127 ../../packages/protocols/graphql build$ tsc
12:48:27.127 ../../packages/protocols/odata-v4 build$ tsc
12:48:27.128 ../../packages/protocols/json-rpc build$ tsc
12:48:31.730 ../../packages/protocols/json-rpc build: Done
12:48:31.755 ../../packages/protocols/odata-v4 build: Done
12:48:32.091 ../../packages/protocols/graphql build: Done
12:48:32.104 ▸ Building project-tracker example…
12:48:32.741
12:48:32.741 > @objectql/example-project-tracker@4.2.2 build /vercel/path0/examples/showcase/project-tracker
12:48:32.741 > tsc && node -e "const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')"
12:48:32.741
12:48:35.198 ✓ Vercel build complete.
12:48:35.212 Warning: Detected "engines": { "node": ">=20" } in your package.json that will automatically upgrade when a new major Node.js Version is released. Learn More: https://vercel.link/node-version
12:48:35.268 Detected pnpm-lock.yaml version 9 generated by pnpm@10.x with package.json#packageManager pnpm@10.28.2
12:48:35.297 Installing dependencies...
12:48:35.933 Scope: all 42 workspace projects
12:48:36.348 ../.. | Progress: resolved 0, reused 1, downloaded 0, added 0
12:48:37.360 ../.. | Progress: resolved 0, reused 51, downloaded 0, added 0
12:48:38.066 ../.. | -209 ---------------------
12:48:38.441 ../.. | Progress: resolved 0, reused 143, downloaded 0, added 0
12:48:38.450 ../.. | Progress: resolved 0, reused 143, downloaded 0, added 0, done
12:48:38.820
12:48:38.830 ../site postinstall$ fumadocs-mdx
12:48:39.241 ../site postinstall: [MDX] generated files in 20.888289999999984ms
12:48:39.247 ../site postinstall: Done
12:48:39.502 Done in 3.8s using pnpm v10.28.2
12:48:39.871 Using TypeScript 5.9.3 (local user-provided)
12:48:43.749 api/[[...route]].ts(412,34): error TS2345: Argument of type 'import("/vercel/path0/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).Plugin' is not assignable to parameter of type 'import("/vercel/path0/apps/demo/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).Plugin'.
12:48:43.749 Types of property 'init' are incompatible.
12:48:43.750 Type '(ctx: import("/vercel/path0/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).PluginContext) => void | Promise' is not assignable to type '(ctx: import("/vercel/path0/apps/demo/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).PluginContext) => void | Promise'.
12:48:43.750 Types of parameters 'ctx' and 'ctx' are incompatible.
12:48:43.750 Type 'import("/vercel/path0/apps/demo/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).PluginContext' is not assignable to type 'import("/vercel/path0/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).PluginContext'.
12:48:43.750 The types returned by 'getKernel()' are incompatible between these types.
12:48:43.750 Type 'import("/vercel/path0/apps/demo/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).ObjectKernel' is not assignable to type 'import("/vercel/path0/node_modules/@objectstack/core/dist/index", { with: { "resolution-mode": "import" } }).ObjectKernel'.
12:48:43.750 Types have separate declarations of a private property 'plugins'.
12:48:43.750
12:48:49.158 Build Completed in /vercel/output [1m]
12:48:49.920 Deploying outputs...
12:48:51.052 Warning: Provided memory setting in vercel.json is ignored on Active CPU billing. You can safely remove this setting from your configuration. Learn more: https://vercel.com/docs/fluid-compute/pricing
12:48:55.280 The framework produced an invalid deployment package for a Serverless Function. Typically this means that the framework produces files in symlinked directories. Please verify the framework settings.
12:48:59.117 Creating build cache...
12:51:30.265 Created build cache: 3m
12:51:30.265 Uploading build cache [229.80 MB]
12:51:32.900 Build cache uploaded: 2.635s

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot 12:47:28.823 Running build in Washington, D.C., USA (East) – iad1
12:47:28.824 Build machine configuration: 4 cores, 8 GB
12:47:28.939 Cloning github.com/objectstack-ai/objectql (Branch: co...

Fixed in 18d9ad6.

The node-linker=hoisted approach introduced a new problem: pnpm creates apps/demo/node_modules/@objectstack/core as a symlink to the root's physical copy. TypeScript resolves the same package via two paths and reports TS2345 — Types have separate declarations of private property 'plugins'. And those hoisted-mode symlinks (to root copies) are exactly what Vercel's bundler rejects.

The real issue is that Vercel runs a second pnpm install (without --ignore-scripts, visible at 12:48:35.297) after our buildCommand completes and before the TypeScript function bundler runs. This second install recreates all pnpm symlinks, undoing any patching done during the build.

The fix exploits the fact that this second install does run lifecycle scripts (it runs fumadocs-mdx for apps/site). By adding a postinstall hook in apps/demo/package.json that calls patch-symlinks.cjs, the dereference pass now runs after the second install's symlinks are created and before the TypeScript bundler sees them. The script is guarded with if (!process.env.VERCEL) exit so it's a no-op in local development.

Also fixed includeFiles in vercel.json: packages/*/dist was evaluated relative to apps/demo/ and matched nothing. Replaced with node_modules/@objectql/example-project-tracker/dist which after patching is a physical directory containing the compiled project-tracker metadata.

@hotlong hotlong marked this pull request as ready for review March 21, 2026 05:47
Copilot AI review requested due to automatic review settings March 21, 2026 05:47
@hotlong hotlong merged commit d90a08a into main Mar 21, 2026
5 checks passed
@hotlong hotlong deleted the copilot/update-node-version-warning branch March 21, 2026 05:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes apps/demo Vercel deployment by aligning build/install behavior with pnpm workspace realities and Vercel’s bundling constraints, while also addressing missing runtime deps and TypeScript bundler type issues in the serverless entry.

Changes:

  • Reorders the Vercel build script to compile packages in dependency-correct order and ensures required drivers/examples are built.
  • Replaces rsync-based YAML copying in showcase examples with a Node-based copy routine (no external tool dependency).
  • Adds Vercel packaging fixes: required public/ output dir, explicit demo deps for function bundling, and a Vercel-gated postinstall symlink “dereference” step.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds missing direct deps for the demo app to satisfy Vercel’s TS/module resolution.
examples/showcase/project-tracker/package.json Removes rsync dependency by copying .yml files via inline Node script during build.
examples/showcase/enterprise-erp/package.json Same rsync → Node inline .yml copy change for build portability.
apps/demo/vercel.json Adjusts includeFiles to include the physical example dist needed at runtime after symlink patching.
apps/demo/scripts/patch-symlinks.cjs Runs only on Vercel; dereferences pnpm symlinks to satisfy Vercel’s bundler.
apps/demo/scripts/build-vercel.sh Fixes build order and builds missing packages; ensures public/ exists for framework: null.
apps/demo/public/.gitkeep Tracks required public/ output directory in git.
apps/demo/package.json Adds Vercel-gated postinstall to patch pnpm symlinks and adds explicit runtime deps.
apps/demo/api/[[...route]].ts Fixes BodyInit typing for raw body + works around AuthPlugin option typing mismatch.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

"start": "ts-node src/index.ts",
"codegen": "objectql types -s src -o src/types",
"build": "tsc && rsync -a --include '*/' --include '*.yml' --exclude '*' src/ dist/",
"build": "tsc && node -e \"const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')\"",
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as project-tracker: the long duplicated inline node -e YAML-copy script in build is hard to maintain and troubleshoot. Consider extracting it into a shared script file and reusing it across example packages.

Suggested change
"build": "tsc && node -e \"const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')\"",
"copy-yaml": "node -e \"const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')\"",
"build": "tsc && npm run copy-yaml",

Copilot uses AI. Check for mistakes.
Comment on lines +47 to 52
// dereference:true ensures nested pnpm .pnpm-store symlinks inside the package
// are also resolved to real files, which is required by Vercel's function bundler.
const tmpPath = abs + '.tmp';
fs.cpSync(realPath, tmpPath, { recursive: true });
fs.cpSync(realPath, tmpPath, { recursive: true, dereference: true });
fs.unlinkSync(abs);
fs.renameSync(tmpPath, abs);
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fs.cpSync(..., { dereference: true }) will follow and copy nested symlinks inside each package (including each package’s own node_modules links under pnpm), which can massively inflate the copied tree and slow builds / risk exceeding Vercel function size limits. If Vercel only rejects top-level symlinks, consider leaving nested symlinks intact (remove dereference: true) or limiting dereferencing to the minimal set of packages/paths required for bundling.

Copilot uses AI. Check for mistakes.
Comment on lines 352 to +363
await withTimeout(kernel.use(new AuthPlugin({
secret: authSecret || 'objectql-demo-dev-secret-change-me-in-production',
baseUrl,
trustedOrigins: [
'http://localhost:*',
...(process.env.VERCEL_URL ? [`https://${process.env.VERCEL_URL}`] : []),
...(process.env.VERCEL_BRANCH_URL ? [`https://${process.env.VERCEL_BRANCH_URL}`] : []),
...(process.env.VERCEL_PROJECT_PRODUCTION_URL ? [`https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`] : []),
...(process.env.AUTH_TRUSTED_ORIGINS ? process.env.AUTH_TRUSTED_ORIGINS.split(',').map(s => s.trim()) : []),
],
})), PLUGIN_TIMEOUT_MS, 'AuthPlugin');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any)), PLUGIN_TIMEOUT_MS, 'AuthPlugin');
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting the AuthPlugin options to any disables type-checking for the entire options object. Prefer a narrow, explicit type workaround (e.g., local intersection type that adds secret, or a module augmentation for AuthPluginOptions) so other option fields remain type-checked.

Copilot uses AI. Check for mistakes.
"seed": "ts-node src/seed.ts",
"codegen": "objectql types -s src -o src/types",
"build": "tsc && rsync -a --include '*/' --include '*.yml' --exclude '*' src/ dist/",
"build": "tsc && node -e \"const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')\"",
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline node -e script in the build command is very long, duplicated across multiple example packages, and difficult to maintain/debug (quoting issues, no stack traces pointing to a file). Consider moving this YAML-copy logic into a small shared script file (e.g., scripts/copy-yml.cjs) and invoking it from package scripts to avoid duplication.

Suggested change
"build": "tsc && node -e \"const fs=require('fs'),p=require('path');function c(s,d){fs.readdirSync(s,{withFileTypes:true}).forEach(e=>{const sp=p.join(s,e.name),dp=p.join(d,e.name);if(e.isDirectory())c(sp,dp);else if(e.name.endsWith('.yml')){fs.mkdirSync(d,{recursive:true});fs.copyFileSync(sp,dp)}})}c('src','dist')\"",
"build": "tsc && node scripts/copy-yml.cjs",

Copilot uses AI. Check for mistakes.
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.

3 participants