Skip to content

Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.

fix(v0.8.1): clean Vercel builds & hardened db-setup

Ashiq Hussain Mirb56d868ecd75
diff --git a/package.json b/package.json
index 711d99e..1d778b6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "canvix",
- "version": "0.8.0",
+ "version": "0.8.1",
"private": false,
"description": "Canvix \u2014 free & open-source graphic design tool. A community-built Canva alternative.",
"scripts": {
diff --git a/scripts/db-setup.sh b/scripts/db-setup.sh
index e889d53..8307267 100755
--- a/scripts/db-setup.sh
+++ b/scripts/db-setup.sh
@@ -21,6 +21,22 @@ cd "$(dirname "$0")/.."
MIGRATION="${1:-0001_init}"
echo "── Canvix database setup ──────────────────────────────"
+
+# Fail fast with an actionable message instead of Prisma's cryptic
+# "Environment variable not found: DATABASE_URL" (or, on GitHub Actions,
+# a confusing P1001 against localhost).
+if [ -z "${DATABASE_URL:-}" ]; then
+ echo " ERROR: DATABASE_URL is not set."
+ echo " - locally: export DATABASE_URL='postgresql://…'"
+ echo " - GitHub Actions: add the DATABASE_URL repository secret"
+ echo " (Settings → Secrets and variables → Actions), then re-run"
+ echo " the Canvix Database Setup workflow."
+ echo " Supabase note: either URL works — the pooler (port 6543) or the"
+ echo " direct connection (port 5432); sslmode/pgbouncer flags are"
+ echo " applied automatically by src/lib/db-url.ts."
+ exit 1
+fi
+
echo " DATABASE_URL host: $(node -e "try{const u=new URL(process.env.DATABASE_URL||'');console.log(u.hostname)}catch{console.log('(unset)')}")"
echo " [1/2] applying migrations…"
diff --git a/src/lib/ai/provider.ts b/src/lib/ai/provider.ts
index c163072..813d482 100644
--- a/src/lib/ai/provider.ts
+++ b/src/lib/ai/provider.ts
@@ -45,8 +45,14 @@ export function resolveProviderConfig(): AIProviderConfig | null {
'/etc/.z-ai-config',
]
for (const p of candidates) {
- if (!p || !existsSync(p)) continue
- const raw = JSON.parse(readFileSync(p, 'utf8')) as { baseUrl?: string; apiKey?: string }
+ // turbopackIgnore: these paths are only knowable at runtime (cwd/$HOME),
+ // so without the opt-out Turbopack traces the WHOLE project into the
+ // server output (slow, oversized Vercel deploys). The file also holds
+ // credentials and must never be copied into build output — production
+ // configuration is env vars (ZAI_BASE_URL / ZAI_API_KEY); the file
+ // fallback is a local-development convenience only.
+ if (!p || !existsSync(/*turbopackIgnore: true*/ p)) continue
+ const raw = JSON.parse(readFileSync(/*turbopackIgnore: true*/ p, 'utf8')) as { baseUrl?: string; apiKey?: string }
if (raw.baseUrl && raw.apiKey) return { baseUrl: raw.baseUrl, apiKey: raw.apiKey }
}
} catch {