fix(cf-deploy): run wrangler from repo root, not dist/zpan

wrangler 4.x errors when it finds both a local wrangler.json and a
parent .wrangler/deploy/config.json redirect file — "base paths do not
match" — which is exactly what happens if you cd into dist/zpan after
the @cloudflare/vite-plugin build.

The old `cd dist/zpan` workaround predates the vite-plugin generating
.wrangler/deploy/config.json on build. Now that the redirect file
exists, running wrangler from the repo root is the correct path:
wrangler picks up the redirect, uses dist/zpan/wrangler.json, and
resolves ../client / index.js / etc. relative to *that* config's
location — all paths correct.

Empirically: `wrangler deploy --dry-run` from root reports
"Read 333 files from the assets directory .../dist/client" and all
three bindings (D1 + R2 + ASSETS) are recognized. No 404.

Fixes the cloudflare deploy job in bonaysoft/zpan's first run of the
new dispatcher.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
saltbo
2026-04-22 23:31:06 -04:00
parent 07973b6520
commit 0adaac8dbe
+5 -4
View File
@@ -151,10 +151,11 @@ jobs:
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Deploy from the @cloudflare/vite-plugin build output so wrangler uses
# the generated dist/zpan/wrangler.json (correct assets directory,
# prebuilt worker) — matches how Cloudflare Workers Builds deploys.
working-directory: dist/zpan
# Run wrangler from the repo root so it uses the @cloudflare/vite-plugin's
# redirect config (.wrangler/deploy/config.json) which points at the
# built Worker (dist/zpan/wrangler.json). Cd'ing into dist/zpan instead
# causes wrangler 4.x to error on conflicting base paths between the
# two configs.
run: npx wrangler deploy
- name: Set BETTER_AUTH_SECRET (first deploy only)