Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…bjectql/core Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/189c511f-af00-4dc2-8920-0719495a9777
|
@copilot 11:25:47.047 Running build in Washington, D.C., USA (East) – iad1 |
…ld-vercel.sh Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/731333d3-1322-401d-919d-f43127ea9c08
The new failure was |
|
@copilot 11:34:07.987 Running build in Washington, D.C., USA (East) – iad1 |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/59c3f3e7-b9a1-48d9-b032-57c74b62079a
Fixed in 4d3a18d. Vercel's build image doesn't include |
|
@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. |
|
@copilot 12:17:08.350 Running build in Washington, D.C., USA (East) – iad1 |
…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
Fixed in 8da7910. The build completed successfully but the deployment failed because |
|
@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
Fixed in 3662ad9. The root cause was a Vercel build-pipeline ordering issue: Vercel runs a second The fix: added Also removed the now-unnecessary |
|
@copilot 12:47:28.823 Running build in Washington, D.C., USA (East) – iad1 |
…l symlinks Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/76ab0fdf-c767-4448-a46c-0d204f18f208
Fixed in 18d9ad6. The The real issue is that Vercel runs a second The fix exploits the fact that this second install does run lifecycle scripts (it runs Also fixed |
There was a problem hiding this comment.
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')\"", |
There was a problem hiding this comment.
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.
| "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", |
| // 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); |
There was a problem hiding this comment.
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.
| 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'); |
There was a problem hiding this comment.
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.
| "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')\"", |
There was a problem hiding this comment.
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.
| "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", |
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:@objectql/core/src/plugin.tsstatically imports from all three plugin packages, so they must be compiled first.@objectql/plugin-optimizationsis added as an explicit step before the other plugins since@objectql/plugin-querydepends on it.apps/demo/scripts/build-vercel.sh— added@objectql/driver-sqlalongside@objectql/driver-memoryin the drivers build step.@objectql/example-project-tracker/src/seed.tsimportsSqlDriverfrom@objectql/driver-sql, which must be compiled before the example is built.examples/showcase/project-tracker/package.jsonandexamples/showcase/enterprise-erp/package.json— replacedrsync -a --include '*.yml' ...(unavailable on Vercel's build image) with an equivalent Node.js inline script that recursively copies.ymlfiles fromsrc/todist/preserving directory structure, with no external tool dependencies.apps/demo/public/.gitkeepandapps/demo/scripts/build-vercel.sh— added thepublicoutput directory required by Vercel when"framework": nullis set. Vercel defaults to looking for apublicdirectory after the build completes. Addedapps/demo/public/.gitkeepto track the directory in git, and addedmkdir -p publicat the end of the build script as a safety measure.apps/demo/package.json,pnpm-lock.yaml, andapps/demo/api/[[...route]].ts— fixed four TypeScript errors surfaced by Vercel's function bundler:@objectstack/runtimeand@objectstack/driver-memoryas explicit direct dependencies (^3.2.8) inapps/demo/package.jsonandpnpm-lock.yaml. These packages were imported byapi/[[...route]].tsbut were only available as transitive dependencies, causingTS2307module-not-found errors.TS2322: Type 'Buffer' is not assignable to type 'BodyInit'by converting the Node.jsBufferto anArrayBuffervia.buffer.slice(byteOffset, byteOffset + byteLength).ArrayBufferis always present inBodyInitregardless of the TypeScript lib target, unlikeUint8Arraywhich is absent in the ES2019 lib used by Vercel's bundler.TS2353: 'secret' does not exist in type 'AuthPluginOptions'by casting the options object asany. Thesecretproperty is correct at runtime (used identically throughout the codebase), but the@objectstack/plugin-auth@3.2.8type definition does not include it.apps/demo/package.jsonandapps/demo/scripts/patch-symlinks.cjs— fixed the "invalid deployment package … symlinked directories" error via apostinstalllifecycle hook. Vercel's build pipeline runs two separatepnpm installpasses: theinstallCommand(pnpm install --ignore-scripts, which skips lifecycle scripts) and an automatic second install afterbuildCommandcompletes (without--ignore-scripts, which runs lifecycle scripts and recreates all pnpm symlinks). The previousnode-linker=hoistedapproach was reverted because it caused pnpm to createapps/demo/node_modules/@objectstack/coreas a symlink to the root's physical copy, which TypeScript resolves as a second module instance and reportsTS2345 — Types have separate declarations of private property 'plugins'. The correct fix is apostinstallscript (node scripts/patch-symlinks.cjs) inapps/demo/package.jsonthat runs after the second install (the right timing window, just before Vercel's TypeScript bundler).patch-symlinks.cjsis guarded withif (!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 whereVERCEL=1.apps/demo/vercel.json— updatedincludeFilesto removepackages/*/dist(was evaluated relative toapps/demo/and matched nothing) and addnode_modules/@objectql/example-project-tracker/distwhich 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.