Skip to content

[wrangler] fix: pass force query parameter to API in pages deployment delete#13444

Merged
jamesopstad merged 4 commits intocloudflare:mainfrom
naile:naile/fix-pages-deployment-delete-force
Apr 17, 2026
Merged

[wrangler] fix: pass force query parameter to API in pages deployment delete#13444
jamesopstad merged 4 commits intocloudflare:mainfrom
naile:naile/fix-pages-deployment-delete-force

Conversation

@naile
Copy link
Copy Markdown
Contributor

@naile naile commented Apr 12, 2026

Improves #12474 — the --force flag was introduced but not wired to the API.

wrangler pages deployment delete --force only skips the confirmation prompt — it does not pass ?force=true to the Cloudflare API. This causes deletion of aliased deployments (branch preview deployments) to fail with error 8000035, breaking automated cleanup of preview environments in CI/CD pipelines.

The existing wrangler delete (Workers) already passes force as a query parameter to the API via URLSearchParams. This PR brings pages deployment delete in line with that behavior.


@naile naile requested a review from workers-devprod as a code owner April 12, 2026 21:16
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 12, 2026

🦋 Changeset detected

Latest commit: 2483b52

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

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

@workers-devprod workers-devprod requested review from a team and jamesopstad and removed request for a team April 12, 2026 21:17
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 12, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 14, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13444

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 2483b52

@petebacondarwin
Copy link
Copy Markdown
Contributor

@naile
Copy link
Copy Markdown
Contributor Author

naile commented Apr 15, 2026

Does this API parameter even exist?

https://developers.cloudflare.com/api/resources/pages/subresources/projects/subresources/deployments/methods/delete

compare with

https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/delete

That's very interesting it's not documented, did not realize :)
The API itself names the parameter in its error response, and you can verify it end‑to‑end with curl:

Without force (current wrangler behavior):

DELETE https://api.cloudflare.com/client/v4/accounts/<account>/pages/projects/<project>/deployments/<deployment-id>
  HTTP 400
  {
    "result": null,
    "success": false,
    "errors": [
      {
        "code": 8000035,
        "message": "You cannot delete an aliased deployment without a `?force=true` parameter in the API request URL."
      }
    ],
    "messages": []
  }

With ?force=true (what this PR sends):

DELETE https://api.cloudflare.com/client/v4/accounts/<account>/pages/projects/<project>/deployments/<deployment-id>?force=true
 HTTP 200
 {
   "result": null,
   "success": true,
   "errors": [],
   "messages": []
 }

Copy link
Copy Markdown
Contributor

@jamesopstad jamesopstad left a comment

Choose a reason for hiding this comment

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

Thanks for this and apologies for the confusion. We've checked with the relevant team and the docs have now been updated.

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Apr 17, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@jamesopstad jamesopstad merged commit cc1413a into cloudflare:main Apr 17, 2026
65 of 70 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 17, 2026
@robertsapunarich
Copy link
Copy Markdown

robertsapunarich commented Apr 17, 2026

Thanks @jamesopstad and @naile . We also updated the API docs to reflect reality.

cc @petebacondarwin

@petebacondarwin
Copy link
Copy Markdown
Contributor

I'll need to update the dev docs too: cloudflare/cloudflare-docs#28200

@naile naile deleted the naile/fix-pages-deployment-delete-force branch April 17, 2026 21:45
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.

5 participants