Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@ai-sdk/openai": "^3.0.52",
"@ai-sdk/react": "^3.0.160",
"@hono/node-server": "^1.19.14",
"@libsql/client": "^0.17.2",
"@objectstack/client": "workspace:*",
"@objectstack/client-react": "workspace:*",
"@objectstack/driver-memory": "workspace:*",
Expand Down Expand Up @@ -57,6 +58,7 @@
"@radix-ui/react-toast": "^1.2.15",
"@radix-ui/react-tooltip": "^1.2.8",
"ai": "^6.0.158",
"better-sqlite3": "^12.9.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"hono": "^4.12.12",
Expand Down
13 changes: 12 additions & 1 deletion apps/studio/scripts/build-vercel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ node scripts/bundle-api.mjs
# apps/studio/, so we must copy the actual module files here for Vercel to
# include them in the serverless function's deployment package.
#
# Note: @libsql/client is now bundled by esbuild, so we no longer copy it.
# Note: @libsql/client has native dependencies that must be copied.
echo "[build-vercel] Copying external native modules to local node_modules..."
for mod in better-sqlite3; do
src="../../node_modules/$mod"
Expand All @@ -52,6 +52,17 @@ for mod in better-sqlite3; do
echo "[build-vercel] ⚠ $mod not found at $src (skipped)"
fi
done
# Copy the @libsql scope (includes @libsql/client and native binaries like @libsql/linux-x64-gnu)
if [ -d "../../node_modules/@libsql" ]; then
mkdir -p "node_modules/@libsql"
for pkg in ../../node_modules/@libsql/*/; do
pkgname="$(basename "$pkg")"
cp -rL "$pkg" "node_modules/@libsql/$pkgname"
done
echo "[build-vercel] ✓ Copied @libsql/*"
else
echo "[build-vercel] ⚠ @libsql not found (skipped)"
fi
# Copy the @ai-sdk scope (dynamically loaded provider packages)
if [ -d "../../node_modules/@ai-sdk" ]; then
mkdir -p "node_modules/@ai-sdk"
Expand Down
6 changes: 3 additions & 3 deletions apps/studio/scripts/bundle-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { build } from 'esbuild';

// Packages that cannot be bundled (native bindings / optional drivers)
const EXTERNAL = [
// @libsql/client is now bundled (pure JS, no native bindings)
// Bundling it solves Vercel deployment issues where external packages
// aren't properly included in the serverless function despite includeFiles config
// @libsql/client has native bindings (platform-specific like @libsql/linux-x64-gnu)
// and must be kept external, then copied to node_modules with includeFiles
'@libsql/client',
'better-sqlite3',
// AI SDK provider packages — dynamically imported based on env vars
'@ai-sdk/anthropic',
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"api/**/*.js": {
"memory": 1024,
"maxDuration": 300,
"includeFiles": "node_modules/{better-sqlite3,@ai-sdk}/**"
"includeFiles": "node_modules/{better-sqlite3,@libsql,@ai-sdk}/**"
}
},
"headers": [
Expand Down
Loading