[wrangler] Avoid eager zone lookups when deploying routes #11921
+188
−341
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.
Describe your change...
When deploying with
routes, Wrangler previously queried the Zones API during successful deployments to try to detect route conflicts.This PR defers that work until the bulk routes update fails, reducing unnecessary API calls and deploy latency. When a conflict is detected, Wrangler surfaces a clearer error that points to the dashboard and lists the conflicting worker(s) + route patterns.
A picture of a cute animal (not mandatory, but encouraged)
(=^..^=)
Test evidence:
pnpm exec cross-env NODE_OPTIONS="$(node scripts/node-options-for-tests.js)" vitest run src/__tests__/deploy.test.ts(frompackages/wrangler)pnpm --filter wrangler check:typepnpm --filter wrangler check:lintChangeset:
wrangler.