Skip to content

[wrangler] Fall back to per-zone routes when a 403 omits code 10000 - #15798

Closed
RealBhupesh wants to merge 3 commits into
cloudflare:mainfrom
RealBhupesh:fix/routes-null-auth-code
Closed

RealBhupesh wants to merge 3 commits into
cloudflare:mainfrom
RealBhupesh:fix/routes-null-auth-code

Conversation

@RealBhupesh

@RealBhupesh RealBhupesh commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15718.

wrangler deploy uploads the script, then updates routes with one bulk request. That request is supposed to fall back to the zone API when the token lacks All Zones. The fallback only ran for error code 10000. The same 403 is sometimes returned with code: null, so the deploy aborted even though the script was already uploaded.

A 403 with code 10000 or with no code now uses the existing per-zone fallback. A 403 that carries a different code still fails.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this restores the existing zone-based route fallback; there is no new user-facing API or config.

Made with Cursor


Devin Review

Bulk route updates only retried per zone for error code 10000. The same
missing All Zones rejection can arrive as HTTP 403 with a null code, which
aborted deploy after the script upload.

Fixes cloudflare#15718
@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfde482

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudflare/deploy-helpers Patch
@cloudflare/remote-bindings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Sep 23, 2026
@workers-devprod
workers-devprod requested review from a team and cjol and removed request for a team September 23, 2026 08:16
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/routes-null-auth-code.md: [@cloudflare/wrangler]
  • packages/deploy-helpers/src/triggers/publish-routes.ts: [@cloudflare/wrangler]
  • packages/deploy-helpers/tests/publish-routes-permission.test.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15798

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15798

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15798

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15798

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15798

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15798

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15798

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15798

miniflare

npm i https://pkg.pr.new/miniflare@15798

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15798

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15798

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@15798

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15798

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15798

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15798

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15798

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15798

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15798

wrangler

npm i https://pkg.pr.new/wrangler@15798

commit: cfde482

The zone fallback used to run for error code 10000 at any HTTP status.
Requiring 403 dropped the existing Wrangler route tests, which return
that code with status 200. A missing code still falls back only on 403.
The zone fallback used to run for error code 10000 at any HTTP status.
Requiring 403 dropped the existing Wrangler route tests, which return
that code with status 200. A missing code still falls back only on 403.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

return false;
}

return e.code === 10000 || (e.status === 403 && e.code == null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Server failures leave old routes attached

When the bulk update returns HTTP 500 with code 10000, isRoutesPermissionError selects the per-zone fallback. That fallback cannot delete existing routes, so deploy can succeed while routes slated for removal remain attached.

Learn more

The bulk route request replaces the Worker's route list. The per-zone fallback only adds routes and warns about existing ones; it cannot remove routes (publishRoutesFallback). The API can return HTTP 500 with error code 10000 for an internal server error, as the server-error fixture demonstrates. Treating that response as a permission error can hide the failed bulk replacement and leave unwanted routes in place.

Example: A Worker has old.example.com/*, and the next deploy requests only new.example.com/*. If the bulk request fails with HTTP 500 and code 10000, fallback adds the new route but leaves the old route attached; deploy reports success.

Recommended fix: Distinguish server failures from the permission rejection before calling publishRoutesFallback; preserve support for genuine non-403 authentication responses such as HTTP 200 with code 10000.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@cjol

cjol commented Sep 25, 2026

Copy link
Copy Markdown
Member

Sorry, but I don't think this is the right fix for the observed problem. A 403 error should not imply "try again with per-zone routes", and even the current workaround is flawed because it doesn't remove routes that should be removed by the batch update. I'll work with the upstream team to ideally aim for even the code: 10000 to not be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

wrangler deploy: route-update fallback never triggers when the 403 carries no code: 10000

3 participants