Bug: Branch subdomains remain linked after repository change

Minor bug discovered when investigating Branch subdomains not working after I changed deploy repository - #9 by AaronP When you have a subdomain linked, then change your repository linked to the Netlify site the subdomain will remain attached to your site.

This doesn’t feel intentional, if you then have a branch with the same name, set that up in branch deploys, and then deploy the branch, it will overwrite the subdomain with new content. However, I wanted to raise this as it feel like best practice would be to remove that subdomain when repository is changed, or ask if you would like them removed.

Steps to reproduce

  1. Create site with a branch deploy set as a subdomain
  2. Change repository for that site
  3. View subdomain still exists for old repo

Expected behavior

Subdomains removed when repository is changed.

Can you submit a pull request?

I wanted to investigate but don’t think this part of Netlify is open source? I’d attempt to dive in if it is!

Thanks for the report, Aaron!

This is intended behavior - deploys are immutable and permanent, as long as you keep the site. If you link to a new repo, great - new builds on the same branch will use the new codebase; old builds on that branch will remain accessible with their old ID and branch designation, though, even if the branchname is now “overloaded” to the new repo. TL;DR we don’t change old deploys in any way short of your deletion of a site.

If you want to be rid of old deploys, old branch subdomains, etc, you’d need to delete and recreate the site; there is no other way to remove deploys as our file storage is not “per deploy” but “per checksum” and so if you introduced your new logo.png in a branch deploy, it is stored in relation to that deploy, and removing that deploy could remove the only copy of the file in our storage.

I understand that’s not super intuitive, but a lot of the details about how we run the CDN aren’t :slight_smile: Seems simple to fix, but would require rearchitecting our entire storage engine to accomplish. This part of our code isn’t open source so no place for you to contribute today but…you’re pretty great, maybe we have a job for you, if you’re shopping??

1 Like

Ah! That’s very interesting. Thanks for the insight, I can imagine there are many complexities that we, as users cannot even comprehend.

Thanks for the clarification! I love Netlify as a company, service, and the people I’ve interacted with.
Would you say the remote experience with Netlify is one that (junior, 1-year exp in enterprise applications placement), could still actively discuss with and learn from more senior engineers and other common in-office experiences?

I only ask because I am pretty relentless in asking questions to understand decisions, always asking why, and found being in the office made that easy vs when covid resulted in lockdowns and we were remote!

Thanks again, I’ve marked your reply as the solution.