Fix RemoteTransport HttpClient2 constructor error in Vercel deployment#1113
Fix RemoteTransport HttpClient2 constructor error in Vercel deployment#1113
Conversation
- Mark @libsql/client as external in bundle-api.mjs - Add @libsql/client to vercel.json includeFiles - Prevents esbuild from bundling @libsql/client which breaks HttpClient2 constructor Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/bba47546-4868-4fbb-94cc-909dd5f6757d Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Update build-vercel.sh to copy @libsql/client to local node_modules - Remove outdated comment about @libsql/client being bundled - Ensures @libsql/client is available in Vercel serverless function Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/bba47546-4868-4fbb-94cc-909dd5f6757d Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude[agent] |
|
@claude[agent] 2026-04-13 07:19:15.144 [info] [Vercel] GET https://objectstack-play-git-claude-fix-find-operat-bf9cc6-object-stack.vercel.app/api/v1/meta/tool?path=v1%2Fmeta%2Ftool |
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/553ba115-2f78-433a-96c4-a8088eb6ebe3 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
|
Fixed in commit 044ae75. Added The previous approach of copying from the monorepo root didn't work because pnpm's strict node_modules structure doesn't hoist scoped packages. With these packages now as direct dependencies of the studio app, Vercel will include them in the serverless function deployment. |
- Add @libsql/client and better-sqlite3 to lockfile - Fixes CI "frozen-lockfile" error after adding dependencies to apps/studio/package.json Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/01213e25-6e79-4f4e-b29e-c08da6842337 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
|
Updated pnpm-lock.yaml in commit df3efb4. The CI was failing because the lockfile was out of sync after adding @libsql/client and better-sqlite3 dependencies to apps/studio/package.json. The lockfile has been regenerated and the CI should now pass. |
|
@claude[agent] |
- Remove better-sqlite3 and @libsql/client from copy loop - These are now direct dependencies installed by pnpm automatically - Prevents infinite recursion error during Vercel build - Keep only @ai-sdk copying logic for workspace dependencies Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/d15f5cb9-a33c-458c-aca4-417104e23d66 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Fixed in commit 466e085. The infinite recursion occurred because Removed the redundant copy logic for these two packages since they're now installed directly by pnpm. Only @ai-sdk packages still need to be copied since they remain workspace dependencies. |
|
@claude[agent] 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. |
- Replace symlinked packages with real files in node_modules - Vercel doesn't support symlinked directories in serverless functions - Use readlink to get real path, then copy with cp -rL - Prevents "invalid deployment package" error from Vercel - Applies to better-sqlite3, @libsql/client, and @ai-sdk packages Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/131c9b60-a3c7-43b6-a080-0de180a91db0 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Fixed in commit e5d5c8d. Vercel rejects symlinked directories in serverless function packages. pnpm creates symlinks in node_modules by default, which caused the "invalid deployment package" error. The build script now dereferences these symlinks by:
This ensures @libsql/client, better-sqlite3, and @ai-sdk packages are real files that Vercel can package correctly. |
|
@claude[agent] [build-vercel] Done. Static files in public/, serverless function in api/[[...route]].js → api/_handler.js
|
- Add .npmrc with node-linker=hoisted to apps/studio - Prevents pnpm from creating symlinks in node_modules - Vercel requires real files, not symlinks, in serverless functions - Simplify build-vercel.sh by removing symlink dereferencing logic - @libsql/client and better-sqlite3 will be installed as real directories Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/500e4ff3-8d32-4122-bb49-7ab36dbba0d8 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Fixed in commit 1fa5437. The symlink dereferencing approach wasn't sufficient because pnpm creates a complex symlink structure throughout node_modules. The proper solution is to configure pnpm to use This is the standard approach for Vercel deployments with pnpm monorepos. |
The
sys_metadatafind operation was failing in production withRemoteTransport: lazy connect failed: HttpClient2 is not a constructor. This occurred when TursoDriver's lazy connection factory attempted to dynamically import@libsql/client.Root cause: esbuild was bundling
@libsql/client, which mangled internal class exports likeHttpClient2, breaking the constructor at runtime.Changes:
@libsql/clientas external to prevent bundling@libsql/clienttoincludeFilespattern for serverless function packaging@libsql/clientfrom monorepo root to localnode_modulesduring buildThis follows the same deployment pattern as other external dependencies like
better-sqlite3.