From 0603609490d731934fdc5b414a9bff48bad36c74 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 08:14:21 +0000 Subject: [PATCH 1/5] docs: add documentation for wrangler pages deployment delete command Co-Authored-By: pbacondarwin@cloudflare.com --- src/content/docs/pages/configuration/api.mdx | 4 ++++ .../configuration/preview-deployments.mdx | 14 +++++++++++ .../docs/pages/platform/known-issues.mdx | 24 +++---------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/content/docs/pages/configuration/api.mdx b/src/content/docs/pages/configuration/api.mdx index 08700dc669dceef..769e9ad684e4b3d 100644 --- a/src/content/docs/pages/configuration/api.mdx +++ b/src/content/docs/pages/configuration/api.mdx @@ -64,6 +64,10 @@ After you have deployed the JavaScript Worker, set a cron trigger in your Worker Cloudflare Pages hosts and serves all project deployments on preview links. Suppose you want to keep your project private and prevent access to your old deployments. You can use the API to delete deployments after a month, so that they are no longer public online. The latest deployment for a branch cannot be deleted. +:::note +To delete individual deployments from the command line, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/#deployment-delete). +::: + ```js const endpoint = "https://api.cloudflare.com/client/v4/accounts/{account_id}/pages/projects/{project_name}/deployments"; diff --git a/src/content/docs/pages/configuration/preview-deployments.mdx b/src/content/docs/pages/configuration/preview-deployments.mdx index 1c9de17123a828d..6e10bfa3e7f8341 100644 --- a/src/content/docs/pages/configuration/preview-deployments.mdx +++ b/src/content/docs/pages/configuration/preview-deployments.mdx @@ -70,6 +70,20 @@ To view branch aliases within your Pages project, select **View build** for any You can attach a Preview alias to a custom domain by [adding a custom domain to a branch](https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/). +## Delete preview deployments + +To clean up old preview deployments, you can delete them using Wrangler: + +```sh +npx wrangler pages deployment delete --project-name +``` + +Use the `--force` (or `-f`) flag to skip the confirmation prompt, which is useful for CI/CD automation. You can find deployment IDs by running [`wrangler pages deployment list`](/workers/wrangler/commands/#deployment-list). + +:::note +The latest deployment for a branch cannot be deleted. +::: + ## Preview indexing by search engines To maintain a healthy SEO profile, it's vital to prevent search engines from finding duplicate content across the web. Because preview deployments are designed to be an exact replica of your production environment, they inherently create this exact situation. Cloudflare Pages by default ensures your search rankings are not harmed by these temporary previews. diff --git a/src/content/docs/pages/platform/known-issues.mdx b/src/content/docs/pages/platform/known-issues.mdx index 04d1efd0fd72dd0..9bccca9962cdb6e 100644 --- a/src/content/docs/pages/platform/known-issues.mdx +++ b/src/content/docs/pages/platform/known-issues.mdx @@ -95,31 +95,13 @@ If you have an issue that you do not see listed, let the team know in the Cloudf You may not be able to delete your Pages project if it has a high number (over 100) of deployments. The Cloudflare team is tracking this issue. -As a workaround, review the following steps to delete all deployments in your Pages project. After you delete your deployments, you will be able to delete your Pages project. - -1. Download the `delete-all-deployments.zip` file by going to the following link: [https://pub-505c82ba1c844ba788b97b1ed9415e75.r2.dev/delete-all-deployments.zip](https://pub-505c82ba1c844ba788b97b1ed9415e75.r2.dev/delete-all-deployments.zip). -2. Extract the `delete-all-deployments.zip` file. -3. Open your terminal and `cd` into the `delete-all-deployments` directory. -4. In the `delete-all-deployments` directory, run `npm install` to install dependencies. -5. Review the following commands to decide which deletion you would like to proceed with: - -- To delete all deployments except for the live production deployment (excluding [aliased deployments](https://developers.cloudflare.com/pages/configuration/preview-deployments/#preview-aliases)): - -```sh -CF_API_TOKEN= CF_ACCOUNT_ID= CF_PAGES_PROJECT_NAME= npm start -``` - -- To delete all deployments except for the live production deployment (including [aliased deployments](https://developers.cloudflare.com/pages/configuration/preview-deployments/#preview-aliases), for example, `staging.example.pages.dev`): +As a workaround, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/#deployment-delete) to delete deployments individually. After you delete your deployments, you will be able to delete your Pages project. ```sh -CF_API_TOKEN= CF_ACCOUNT_ID= CF_PAGES_PROJECT_NAME= CF_DELETE_ALIASED_DEPLOYMENTS=true npm start +npx wrangler pages deployment delete --project-name ``` -To find your Cloudflare API token, log in to the [Cloudflare dashboard](https://dash.cloudflare.com), select the user icon on the upper righthand side of your screen > go to **My Profile** > **API Tokens**. - -You need a token with `Cloudflare Pages Edit` permissions. - -To find your Account ID, refer to [Find your zone and account ID](/fundamentals/account/find-account-and-zone-ids/). +Use the `--force` flag to skip the confirmation prompt, which is useful for scripting bulk deletions. ## Use Pages as Origin in Cloudflare Load Balancer From 553b33b2ccf283160e62757a684f6694c2d85a1e Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 17 Apr 2026 17:03:22 +0100 Subject: [PATCH 2/5] Apply suggestion from @petebacondarwin --- src/content/docs/pages/platform/known-issues.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/platform/known-issues.mdx b/src/content/docs/pages/platform/known-issues.mdx index 9bccca9962cdb6e..06ca48f00c20cf4 100644 --- a/src/content/docs/pages/platform/known-issues.mdx +++ b/src/content/docs/pages/platform/known-issues.mdx @@ -101,7 +101,7 @@ As a workaround, you can use [`wrangler pages deployment delete`](/workers/wrang npx wrangler pages deployment delete --project-name ``` -Use the `--force` flag to skip the confirmation prompt, which is useful for scripting bulk deletions. +Use the `--force` flag to skip the confirmation prompt and to force deletion of aliased deployments. ## Use Pages as Origin in Cloudflare Load Balancer From 36381773960402172c28be4cee6ad3759b96b507 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 17 Apr 2026 17:04:18 +0100 Subject: [PATCH 3/5] Apply suggestion from @petebacondarwin --- src/content/docs/pages/configuration/preview-deployments.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/pages/configuration/preview-deployments.mdx b/src/content/docs/pages/configuration/preview-deployments.mdx index 6e10bfa3e7f8341..3d1c3e0e8154ada 100644 --- a/src/content/docs/pages/configuration/preview-deployments.mdx +++ b/src/content/docs/pages/configuration/preview-deployments.mdx @@ -78,7 +78,7 @@ To clean up old preview deployments, you can delete them using Wrangler: npx wrangler pages deployment delete --project-name ``` -Use the `--force` (or `-f`) flag to skip the confirmation prompt, which is useful for CI/CD automation. You can find deployment IDs by running [`wrangler pages deployment list`](/workers/wrangler/commands/#deployment-list). +Use the `--force` (or `-f`) flag to skip the confirmation prompt, and to force deletion of aliased deployments. You can find deployment IDs by running [`wrangler pages deployment list`](/workers/wrangler/commands/#deployment-list). :::note The latest deployment for a branch cannot be deleted. From 77419dd1d67711d7e76962cd9d97efaa075321a0 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 17 Apr 2026 23:15:00 +0100 Subject: [PATCH 4/5] fix: update broken links to pages commands --- src/content/docs/pages/configuration/api.mdx | 2 +- src/content/docs/pages/configuration/preview-deployments.mdx | 2 +- src/content/docs/pages/platform/known-issues.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/pages/configuration/api.mdx b/src/content/docs/pages/configuration/api.mdx index 769e9ad684e4b3d..603c7e220730356 100644 --- a/src/content/docs/pages/configuration/api.mdx +++ b/src/content/docs/pages/configuration/api.mdx @@ -65,7 +65,7 @@ After you have deployed the JavaScript Worker, set a cron trigger in your Worker Cloudflare Pages hosts and serves all project deployments on preview links. Suppose you want to keep your project private and prevent access to your old deployments. You can use the API to delete deployments after a month, so that they are no longer public online. The latest deployment for a branch cannot be deleted. :::note -To delete individual deployments from the command line, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/#deployment-delete). +To delete individual deployments from the command line, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/pages/#pages-deployment-delete). ::: ```js diff --git a/src/content/docs/pages/configuration/preview-deployments.mdx b/src/content/docs/pages/configuration/preview-deployments.mdx index 3d1c3e0e8154ada..b44d067e07f0b22 100644 --- a/src/content/docs/pages/configuration/preview-deployments.mdx +++ b/src/content/docs/pages/configuration/preview-deployments.mdx @@ -78,7 +78,7 @@ To clean up old preview deployments, you can delete them using Wrangler: npx wrangler pages deployment delete --project-name ``` -Use the `--force` (or `-f`) flag to skip the confirmation prompt, and to force deletion of aliased deployments. You can find deployment IDs by running [`wrangler pages deployment list`](/workers/wrangler/commands/#deployment-list). +Use the `--force` (or `-f`) flag to skip the confirmation prompt, and to force deletion of aliased deployments. You can find deployment IDs by running [`wrangler pages deployment list`](/workers/wrangler/commands/pages/#pages-deployment-list). :::note The latest deployment for a branch cannot be deleted. diff --git a/src/content/docs/pages/platform/known-issues.mdx b/src/content/docs/pages/platform/known-issues.mdx index 06ca48f00c20cf4..c560c47dd20d103 100644 --- a/src/content/docs/pages/platform/known-issues.mdx +++ b/src/content/docs/pages/platform/known-issues.mdx @@ -95,7 +95,7 @@ If you have an issue that you do not see listed, let the team know in the Cloudf You may not be able to delete your Pages project if it has a high number (over 100) of deployments. The Cloudflare team is tracking this issue. -As a workaround, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/#deployment-delete) to delete deployments individually. After you delete your deployments, you will be able to delete your Pages project. +As a workaround, you can use [`wrangler pages deployment delete`](/workers/wrangler/commands/pages/#pages-deployment-delete) to delete deployments individually. After you delete your deployments, you will be able to delete your Pages project. ```sh npx wrangler pages deployment delete --project-name From cf0b9a6c24043add4d3b0febfc581b4d4b8b576a Mon Sep 17 00:00:00 2001 From: Matt 'TK' Taylor Date: Mon, 20 Apr 2026 15:06:48 +0100 Subject: [PATCH 5/5] fix: update docs to include equivalent shell script for deleting all pages project deployments --- src/content/docs/pages/platform/known-issues.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/content/docs/pages/platform/known-issues.mdx b/src/content/docs/pages/platform/known-issues.mdx index c560c47dd20d103..afb0c0c3852cca3 100644 --- a/src/content/docs/pages/platform/known-issues.mdx +++ b/src/content/docs/pages/platform/known-issues.mdx @@ -103,6 +103,14 @@ npx wrangler pages deployment delete --project-name --json \ + | jq -r '.[].Id' \ + | xargs -I {} npx wrangler pages deployment delete {} --project-name --force +``` + ## Use Pages as Origin in Cloudflare Load Balancer [Cloudflare Load Balancing](/load-balancing/) will not work without the host header set. To use a Pages project as target, make sure to select **Add host header** when [creating a pool](/load-balancing/pools/create-pool/#create-a-pool), and set both the host header value and the endpoint address to your `pages.dev` domain.