How to Delete Aliased Preview Deployments?

Hello,

I would like to delete a branch created by dependabot, however the dashboard doesn’t allow me from deleting the preview deployment because it is assigned to an alias.

The deployment isn’t useful anymore, and the branch associated with the deployment is deleted, may I know how can I delete it?

Thanks.

7 Likes

I’m just now facing something similar to this (transitioning to live site instead of Pages). I had to delete the alias from the Custom Domains tab.

@sdayman Thanks for the reply.

The alias for custom domain (production) can be deleted, but I am trying to delete a preview deployment. Pages doesn’t seem to allow me to do this. (The alias is auto generated by Pages with the branch name)

2 Likes

I am facing the same problem here, my github repo was using some not-so-good branch name, and created an auto deployment in Cloudflare Pages, then an alias was created under such <not-so-good>.<page-id>.pages.dev the Pages system is telling can only push new commits to the branch but cannot delete the only deployment under this branch,

Even I have deleted the branch from Github repo, but CF Pages doesn’t synchronize and would show the alias for-ever?

This is insane

+1

I am also facing the same issue and hoping someone can provide a solution.

+1 ditto
API responds with “Cannot delete aliased deployment” for the last deployment of a (now old and deleted from the repo) branch

Thanks for the reports, made an internal ticket for the Pages team to investigate.

4 Likes

@azhao Thanks! Hope this will be fixed soon.

1 Like

What is the status of this investigation? :slight_smile: I’m still experiencing this issue.

Also unable to delete an accidentally created and unneeded preview deploy on account of it being aliased to <spurious-branch>.<myproject>.pages.dev.

+1 unable to delete a no longer needed alias preview deployment.

It’s too bad that this continues to go unaddressed, as for me it’s a fatal flaw in an otherwise excellent platform.

If I push a git branch, there will be a preview deployment forever? No thanks.

I was so happy to find Cloudflare Pages, it was fast and easy to get set up… but unfortunately I am going to have to look elsewhere for static web page hosting.

facing the same issue, any solution yet?

+1

Not bring able to delete the last build for an alias / the alias itself isn’t great for a few reasons.
In my case it lead to using old urls not realising they are outdated (e.g. going to new.mysite.pages.dev when actually it’s next.mysite.pages.dev). Had the old one been cleaned up I would have seen the 404 and checked the URL.

Wow, this is crazy.

My workaround was to delete and recreate the entire project.

After a year, I would like to provide an update on this issue.

TL;DR: This is an expected behaviour.

According to a discussion on the CF Discord Server, Pages prevents us from deleting a preview deployment probably because CF wants to minimise the risk of deleting important deployments, like staging, accidentally. There is a quote from Walshy from CF:

I wasn’t around when it was made but I can only assume it was made so you don’t accidentally delete something like staging
It’s more of a safety thing than anything
People use the aliases a lot so keeping a version of that around and not deletable makes sense

Source: Discord

The original question was raised by elijah: Discord

While I understand this is intended for safety, I still hope Pages will allow us to delete other preview deployments as deleting some of them is not “destructive” at all. I believe Pages could still minimise the risk of developers deleting important deployments accidentally with reconfirmation or allow developers to configure “protected” preview deployments which cannot be deleted easily.

Pages is a great product and it would be even better if this could be addressed.