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.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
fix(v0.11.2): editor Projects panel crash + Cloudflare Workers Builds deploy
Ashiq Hussain Mir01ec59a52f08
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bf38416..d8659fc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,49 @@All notable changes to Canvix will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).+## [0.11.2] — 2026-10-30++Two production bugs: an editor crash with an easy-to-miss root cause,+and a Cloudflare git-deploy that could never have worked.++### Fixed+- **Editor's Projects panel crashed the whole editor ("This page couldn't+ load")** — `/api/designs` has returned a keyset-paginated+ `{ designs, nextCursor }` envelope since v0.9.2; the dashboard was+ updated back then, but the editor's left-rail Projects panel still+ assumed the pre-v0.9.2 bare array. The envelope object hit `.filter()`+ on first render and took down the entire React tree the moment the+ fetch resolved — every time, on every design list (opening a template+ was just the way users got to the panel). The panel now parses the+ envelope (first page, newest first — it's a quick switcher), and a+ Playwright regression test locks the flow: open a design → Projects+ panel → designs listed, zero page errors.+- **Cloudflare Workers Builds deploys failed with "Could not find+ compiled Open Next config"** — the git-connected pipeline runs+ `npm run build` then `npx wrangler deploy`; wrangler detects the+ OpenNext project and delegates to `opennextjs-cloudflare deploy`,+ which requires the compiled `.open-next/` output. But `npm run build`+ only ever produced the standalone Node output — and wrangler's OpenNext+ delegation runs *before* it would execute any configured `build.command`,+ so nothing in the pipeline ever built the worker. Fix: `npm run build`+ is now `scripts/build.mjs`, which detects the Workers Builds environment+ via its documented `WORKERS_CI=1` marker and runs+ `opennextjs-cloudflare build` there (plain `next build` + standalone+ copy steps everywhere else — Vercel, Netlify and self-hosted builds are+ byte-identical to before). Second half of the fix:+ `opennextjs-cloudflare build` builds the Next.js app by spawning the+ project's own `npm run build` — with the new branch that would recurse+ forever inside Workers CI, so `open-next.config.ts` now sets+ `buildCommand: "next build"` to break the cycle. Verified locally:+ `WORKERS_CI=1 npm run build` produces `.open-next/worker.js` (single+ build pass), and `npx wrangler deploy` proceeds through the OpenNext+ delegation to the auth check (Workers Builds injects the token in the+ real pipeline).++### Changed+- README: the Cloudflare Workers section now documents git-connected+ Workers Builds (keep the dashboard defaults — the build auto-detects).+## [0.11.1] — 2026-10-30Production smoke-test release: the focused v0.11.0 verificationdiff --git a/README.md b/README.mdindex 4292323..b23362a 100644--- a/README.md+++ b/README.md@@ -478,6 +478,15 @@ npm run deploy # → https://canvix.<you>.workers.d# then open /api/health on the deployed URL — {"ok":true} = full stack green```+> **Git-connected builds (Workers Builds):** just connect the repo and keep+> the defaults — build command `npm run build`, deploy command+> `npx wrangler deploy`. Since v0.11.2 the build script detects the Workers+> Builds environment (`WORKERS_CI=1`) and produces the OpenNext worker+> output (`.open-next/`) that `wrangler deploy` needs; on every other+> platform the same command builds the standard standalone output. Set+> `DATABASE_URL` as a build/secret variable (the **transaction pooler**+> URL) and deploys go green end-to-end.+> **Local preview note:** `npm run preview` is great for UI and no-DB> routes, but some environments' local `wrangler dev` cannot open the> Postgres TLS upgrade (a workerd runtime quirk — details indiff --git a/open-next.config.ts b/open-next.config.tsindex 73a3c33..5a4452c 100644--- a/open-next.config.ts+++ b/open-next.config.ts@@ -12,4 +12,20 @@ import { defineCloudflareConfig } from "@opennextjs/cloudflare";// r2IncrementalCache:// import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache";// export default defineCloudflareConfig({ incrementalCache: r2IncrementalCache });-export default defineCloudflareConfig();+//+// v0.11.2: `buildCommand` breaks a recursion. `opennextjs-cloudflare+// build` builds the Next.js app by spawning the project's own+// `npm run build` (its default buildCommand). Since scripts/build.mjs+// routes `npm run build` to `opennextjs-cloudflare build` inside+// Cloudflare Workers Builds (WORKERS_CI=1), the default would recurse+// forever: build → opennext build → npm run build → opennext build → …+// Spawning `next build` directly is equivalent (the env-var standalone+// mode OpenNext sets still applies) and terminates. This also makes the+// manual `npm run preview` / `deploy` / `upload` scripts leaner — they+// no longer re-run the standalone copy steps inside the spawned build.+const config = {+ ...defineCloudflareConfig(),+ buildCommand: "next build",+};++export default config;diff --git a/package.json b/package.jsonindex 17e929d..fc424e5 100644--- a/package.json+++ b/package.json@@ -1,11 +1,11 @@{"name": "canvix",- "version": "0.11.1",+ "version": "0.11.2","private": false,"description": "Canvix — free & open-source graphic design tool. A community-built Canva alternative.","scripts": {"dev": "next dev -p 3000 2>&1 | tee dev.log",- "build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",+ "build": "node scripts/build.mjs","postinstall": "prisma generate && node scripts/patch-prisma-wasm.mjs","start": "NODE_ENV=production bun .next/standalone/server.js 2>&1 | tee server.log","lint": "eslint .",diff --git a/scripts/build.mjs b/scripts/build.mjsnew file mode 100644index 0000000..bd1a5c2--- /dev/null+++ b/scripts/build.mjs@@ -0,0 +1,57 @@+// scripts/build.mjs — one build entrypoint for every deploy target+// (Canvix v0.11.2).+//+// WHY+// `npm run build` used to be `next build` + the standalone copy steps+// — the output Vercel / self-hosted Node / Netlify's Next runtime+// need. But a Cloudflare Workers git-connected build (Workers Builds)+// runs `npm run build` and then `npx wrangler deploy`, and wrangler+// detects the OpenNext project and delegates to+// `opennextjs-cloudflare deploy`, which requires the compiled+// `.open-next/` output — output that plain `next build` never+// produces. Result: "Could not find compiled Open Next config, did+// you run the build command?" (production incident 2026-10-29).+//+// Wrangler's own `build.command` config cannot fix this: the OpenNext+// delegation check runs BEFORE wrangler would execute a configured+// build command, so the only place to produce `.open-next/` in that+// pipeline is the dashboard's build command itself — this script.+//+// HOW+// Workers Builds documents `WORKERS_CI=1` in its build environment+// (developers.cloudflare.com/workers/ci-cd/builds/configuration/);+// Vercel, Netlify and local shells never set it. So:+//+// WORKERS_CI=1 → opennextjs-cloudflare build+// (runs `next build` internally, emits .open-next/ —+// exactly what `wrangler deploy` → the OpenNext+// delegation expects; the standalone copy steps+// are pointless for Workers and are skipped)+// otherwise → next build && copy static+public into+// .next/standalone (unchanged behavior for every+// other target)+//+// The manual Cloudflare scripts (`npm run preview` / `deploy` /+// `upload`) already run opennextjs-cloudflare themselves and are+// unaffected.++import { execSync } from 'node:child_process'++/** run a shell command, inheriting stdio so CI logs stream normally */+function run(cmd) {+ execSync(cmd, { stdio: 'inherit' })+}++const isWorkersBuildsCi = process.env.WORKERS_CI === '1'++if (isWorkersBuildsCi) {+ console.log('[build] Cloudflare Workers Builds detected (WORKERS_CI=1) → building the OpenNext worker (.open-next/)')+ // wrangler.jsonc exists, so the "no wrangler config" prompt cannot fire;+ // the build itself is non-interactive in CI either way.+ run('opennextjs-cloudflare build')+} else {+ run('next build')+ // standalone server layout (Vercel / self-hosted `npm start` / Netlify)+ run('cp -r .next/static .next/standalone/.next/')+ run('cp -r public .next/standalone/')+}diff --git a/src/components/editor/panels/ProjectsPanel.tsx b/src/components/editor/panels/ProjectsPanel.tsxindex 3f37968..2f1beda 100644--- a/src/components/editor/panels/ProjectsPanel.tsx+++ b/src/components/editor/panels/ProjectsPanel.tsx@@ -28,9 +28,16 @@ export function ProjectsPanel() {useEffect(() => {let alive = true- fetch('/api/designs')- .then((r) => (r.ok ? r.json() : []))- .then((rows: DesignRow[]) => { if (alive) setDesigns(rows) })+ // v0.11.2 fix: /api/designs is keyset-paginated since v0.9.2 and returns+ // { designs: [...], nextCursor } — this panel still assumed the pre-v0.9.2+ // bare array, so the envelope object hit `.filter()` and crashed the whole+ // editor tree ("This page couldn't load"). The panel is a quick switcher;+ // the first page (60 rows, newest first) is the right scope.+ fetch('/api/designs', { cache: 'no-store' })+ .then((r) => (r.ok ? r.json() : Promise.reject(new Error('failed'))))+ .then((body: { designs?: DesignRow[] }) => {+ if (alive) setDesigns(Array.isArray(body?.designs) ? body.designs : [])+ }).catch(() => { if (alive) setDesigns([]) })return () => { alive = false }}, [])diff --git a/tests/e2e/smoke.spec.ts b/tests/e2e/smoke.spec.tsindex 404f421..bb8d43e 100644--- a/tests/e2e/smoke.spec.ts+++ b/tests/e2e/smoke.spec.ts@@ -35,4 +35,37 @@ test.describe('Canvix smoke', () => {await expect(page.getByLabel('Design canvas')).toBeVisible({ timeout: 30_000 })await expect(page.locator('.konvajs-content').first()).toBeVisible({ timeout: 30_000 })})++ // v0.11.2 regression: /api/designs has returned a keyset-paginated+ // { designs, nextCursor } envelope since v0.9.2, but the editor's+ // Projects panel still assumed a bare array — the envelope object hit+ // `.filter()` and took down the whole editor tree ("This page couldn't+ // load"). Opening a design and then the Projects panel must list designs.+ test('editor Projects panel lists designs without crashing', async ({ page }) => {+ const pageErrors: string[] = []+ page.on('pageerror', (err) => pageErrors.push(err.message))++ await page.goto('/')+ await page.getByRole('button', { name: /start designing/i }).first().click()+ await expect(page.getByLabel('Create a design')).toBeVisible()++ await page+ .locator('section:has(h2:text("Start a new design")) [aria-label^="Create "]')+ .first()+ .click()+ await expect(page.getByLabel('Design canvas')).toBeVisible({ timeout: 30_000 })++ // the editor's left-rail Projects panel+ await page.getByRole('button', { name: 'Projects' }).click()++ // "Loading your projects…" resolves into the panel list — the design+ // created above must appear (the panel fetch is the crashed call).+ await expect(page.getByText('Your saved designs')).toBeVisible()+ await expect(page.getByText('Loading your projects…')).toBeHidden({ timeout: 15_000 })+ await expect(page.getByText(/No saved designs yet|No matches/)).toBeHidden()++ // the editor tree must not have crashed+ await expect(page.getByText('This page couldn’t load')).toHaveCount(0)+ expect(pageErrors, pageErrors.join('\n')).toEqual([])+ })})