Skip to content

fix(ci): repair preview Workers left without preview URLs - #1030

Merged
krambertech merged 1 commit into
mainfrom
kateryna/fix-app-preview-alias
Oct 25, 2026
Merged

krambertech merged 1 commit into
mainfrom
kateryna/fix-app-preview-alias

Conversation

@krambertech

@krambertech krambertech commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The app preview job now creates a preview Worker whenever its workers.dev and preview URLs are off, not only when the Worker is missing, so a half-created Worker repairs itself on the next run.
  • The create step retries wrangler deploy up to three times, so a new pull request's first run survives Cloudflare's 10007 race instead of failing.

Why

Since about 21:00 UTC on 24 Oct, a brand-new preview Worker's first wrangler deploy uploads the script and then fails on Wrangler's next call, GET /workers/workers/lymi-app-pr-<n>, with "This Worker does not exist on your account. [code: 10007]". That call is Wrangler's read before it enables workers.dev and preview URLs, so the Worker is left with both off. Every rerun then saw the Worker as existing, skipped the create step, and wrangler versions upload --preview-alias preview reported no preview URL because previews_enabled was false.

  • First attempts: PR 1024 (job 120988585980), 1025 (job 120988089871), 1026 (job 120992039999) and 1027 (job 120991929905) all log Uploaded lymi-app-pr-<n> followed by the 10007 error.
  • Reruns on the same PRs skip the create step, and the upload prints no Version Preview URL, so preview-url.mjs throws.
  • PR 1024 recovered only after its Worker was deleted and recreated at 21:46, when the first deploy happened to win the race. Wrangler is pinned at 4.149.0 in the lockfile for passing and failing runs, so the change is on Cloudflare's side. A similar report fixes the same race by retrying the first deploy.

Open PRs whose preview Worker is already stuck, such as 1026 and 1027, recover after a rebase onto this change: preparing the preview sees preview URLs off and redeploys.

Instrumentation

None: this changes CI provisioning only, with no learner behaviour or product event.

Verification

  • node --test scripts/app-preview-infrastructure.test.mjs: 17 pass. The new test for a Worker that exists with preview URLs off fails on main and passes here, as do the two updated readiness tests.
  • pnpm verify:changed handed over to the full gate (the diff touches ci.yml) and failed locally in apps/web typecheck: this worktree's install predates @cloudflare/vitest-plugin. Left to CI, which installs fresh.
  • This pull request's own app preview job (job 121136623742) passed on its first run: the create step deployed lymi-app-pr-1030, the upload printed Version Preview Alias URL: https://preview-lymi-app-pr-1030.k-porshnieva.workers.dev, and the sign-in and seeded-data checks passed. That first deploy did not hit the 10007 race, so the retry was not exercised.

🤖 Generated with Claude Code

A new preview Worker's first wrangler deploy now fails with Cloudflare
code 10007 after the upload, before Wrangler enables workers.dev and
preview URLs. Reruns saw the Worker as existing and skipped the deploy,
so versions upload never returned the stable preview alias.

Deploy whenever the Worker's preview URLs are off, and retry the deploy
so a first run survives the race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@krambertech
krambertech merged commit dc3efc8 into main Oct 25, 2026
14 of 16 checks passed
@krambertech
krambertech deleted the kateryna/fix-app-preview-alias branch October 25, 2026 10:10

This branch was successfully deployed

2 active deployments
app-preview — 09b9b143 Deployed Oct 25, 2026 by krambertech via cleanup #656
site-preview — 09b9b143 Deployed Oct 25, 2026 by krambertech via site preview #2817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant