fix(worker): wire D1 migrations_dir + correct deploy runbook (GOAP-252) - #1019
Merged
Conversation
wrangler.jsonc bound D1 but had no migrations_dir, so the 12 schema migrations could never apply. The runbook provisioned Turso (only used by the legacy seed script) and used placeholder domains for APP_BASE_URL and WebAuthn, which would break CORS, recovery links, signed URLs, and passkeys even after a successful deploy. Point migrations at packages/schema/migrations and document the real production origins plus VITE_API_BASE_URL. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
Deploying do-epub-studio with
|
| Latest commit: |
e623b03
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6c728ee6.do-epub-studio.pages.dev |
| Branch Preview URL: | https://fix-worker-api-deploy-gaps.do-epub-studio.pages.dev |
Contributor
Up to standards ✅🟢 Issues
|
This was referenced Aug 21, 2026
d-o-hub
added a commit
that referenced
this pull request
Aug 21, 2026
) PR #1019 wired migrations_dir as `../packages/schema/migrations`, which resolves relative to apps/worker/ to the nonexistent apps/packages path — `wrangler d1 migrations apply` could never find the 12 migrations. The placeholder database_id/KV id also blocked migration application, and APP_BASE_URL/WebAuthn still pointed at example.com/localhost. Replace placeholders with the provisioned resources (D1 do-epub-studio, KV CACHE_KV), correct migrations_dir to ../../packages/schema/migrations, and set real Pages origins so no deploy path bakes in placeholder domains. 🤖 Generated with Codebuff Co-authored-by: d-oit <d-oit@users.noreply.github.com> Co-authored-by: Codebuff <noreply@codebuff.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Follow-up to PR #1018 (GOAP-252 / issue #1014): the release now deploys the worker and asserts
/api/health, but two more credential-free blockers would have broken the deploy even with credentials:1. D1 migrations could never apply (
wrangler.jsonc)The Worker's runtime DB is D1 (
env.DB), and all 12 migrations live inpackages/schema/migrations/— butwrangler.jsonchad nomigrations_dir, sowrangler d1 migrations apply(and deploy-time migrations) would find nothing. The database would deploy empty: every query fails, login included.→ Added
migrations_dir: "../packages/schema/migrations"to the D1 binding. Verified withwrangler deploy --dry-run(config parses; bindings listed).2. Runbook provisioned the wrong DB + placeholder origins (
docs/runbooks/infrastructure-setup.md)APP_BASE_URL=https://do-epub-studio.example.com— a nonexistent domain baked into CORS, recovery emails, and signed file URLs.WEBAUTHN_RP_ID=localhost/WEBAUTHN_ORIGIN=http://localhost:5173defaults would break admin passkey login.VITE_API_BASE_URLstep — the web build only calls the Worker cross-origin when that env is baked in at build time.→ Rewrote the runbook: D1 provisioning +
migrations_dir, real production origins (https://do-epub-studio.onrender.comfrontend /https://api.do-epub-studio.workers.devAPI), WebAuthn secrets, KV namespace step,VITE_API_BASE_URLbuild step, deploy +/api/healthverification, and a GOAP-252 API-contract checklist.Verification
pnpm exec wrangler deploy --config wrangler.jsonc --dry-run— passes, bindings correctnode scripts/check-adr-index.mjs— passesdocs-validation.yml) — no broken linksRemaining (credentials, tracked in #1014)
Provision D1/KV/R2, add
CLOUDFLARE_API_TOKEN+CLOUDFLARE_ACCOUNT_IDsecrets, set Worker secrets (APP_BASE_URL/WebAuthn/etc.), deploy, setVITE_API_BASE_URLon Render, rebuild.