You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit acbdba9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(deploy): Wait until Cloudflare serves a version before deploying it (#2438)
Production deploys keep stopping at the stage step with Cloudflare error
100146 ("The requested Worker version could not be found"), for example
in
[43952070458](https://github.com/getsentry/toolkit/actions/runs/43952070458)
and
[44604518080](https://github.com/getsentry/toolkit/actions/runs/44604518080).
Prod stays on the old version, but someone has to restart the deploy.
Wrangler's versions deploy fetches each version by ID before it creates
the deployment
([source](https://github.com/cloudflare/workers-sdk/blob/wrangler%404.156.1/packages/wrangler/src/versions/deploy.ts)).
Stage starts a few seconds after upload, and in that window Cloudflare
can still answer 404 for the new version.
`deployVersions()` in `scripts/cloudflare-deployment.mjs` is now the
only way to move traffic. It waits until Cloudflare returns every
version by ID three times in a row, then deploys. 404, 429, 5xx, and
network errors mean "not yet"; auth and other errors fail at once. The
wait gives up after 60 seconds, before any traffic moves, so a version
that never appears fails the job instead of holding the deploy queue.
Stage, promote, recovery, and the Docs MCP deploy (which had the same
race) all use it. Workflows that call Wrangler's deploy directly are
rejected, and AGENTS.md records that rule next to what enforces it.
The 60-second limit comes from Cloudflare history: production stages
from Nov 10 to Nov 19 ran 3.1 to 5.9 seconds after upload, and the two
failures hit the 404 at about 3.6 and 4.6 seconds. Some stages that ran
earlier than that succeeded, so the lag looks like lagging replicas
rather than a fixed delay. That is why one successful read is not
enough.
<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_cf6800c4aced5971469327ef0837e3a4
-->
--
[View
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_cf6800c4aced5971469327ef0837e3a4)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_cf6800c4aced5971469327ef0837e3a4/?project=4510944073809921)
<!-- junior-session-footer:end -->
---------
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <23610+dcramer@users.noreply.github.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,12 @@ Toolkit contains the Sentry CLI, the Sentry MCP server, and shared code. Product
16
16
-**Lint rules**: Write new lint rules for Oxlint: a built-in rule in `.oxlintrc.json`, or a custom rule in `packages/cli/lint-rules/cli-oxlint-plugin.js`. Do not add ast-grep rules. See docs/contributing/coding-guidelines.md#formatting-and-linting.
17
17
-**Package CI**: Put checks for one workspace package in its `package.json` scripts and `sentryCi`, which `test.yml` runs per project. Do not add a workflow for them. See docs/operations/github-actions.md#package-ci-checks.
| Move Cloudflare traffic only with `deployVersions()`, never `wrangler versions deploy`; Cloudflare 404s (100146) on a fresh version for seconds |`scripts/deploy-workflow.test.mjs` (`pnpm run test:ci-projects`) |
0 commit comments