Wrangler Workflows
Use for commands, flags, and validation steps with wrangler in this repo.
Defaults for this project
- •Remote-only resources (Workers AI, Vectorize, D1) → use
wrangler dev --remote. - •Scripts:
npm run dev,npm run ui:dev,npm run deploy:production,npm run db:migrate[:remote]. - •Bindings live in
wrangler.jsonc; keepnodejs_compatflag.
Dev workflow
- •Install deps if needed:
npm install(andcd ui && npm installif UI work). - •Run
wrangler dev --remote --port 8787from repo root; ensurewrangler logindone. - •For UI:
npm run ui:devin parallel. - •Watch logs; fix binding errors by matching names in
wrangler.jsonc.
Deploy workflow
- •Build UI:
npm run build. - •Apply D1 migrations:
npm run db:migrate:remote. - •Deploy:
wrangler deploy(ornpm run deploy:production). - •Verify routes/custom domain; check rate-limiters and secrets present.
Migrations
- •Create:
npm run db:create-migration -- <name>. - •Apply local:
npm run db:migrate. - •Apply remote:
npm run db:migrate:remote(required before deploy).
Secrets
- •Use
wrangler secret put <NAME>(e.g.,CHAT_LOG_IP_SALT). Keep salts out of vars.
Troubleshooting
- •Binding not found → re-run
wrangler dev --remoteor fixwrangler.jsoncIDs. - •Vectorize/AI errors locally → must be remote mode.
- •Rate limit errors → adjust limiter config or lower test load.