Branch deploy failing to use branchname for url

We have branch deploys set up and for the most part they are working amazingly.

Sometimes, though, the deploy fails to use the branch name and instead use what i have to assume is the branch id (it matches the url /deploys/deployId) which means we can see it, but it changes with each push to the branch.

We tried to figure out what was causing this… if it’s branch names with slashes, or branch names that are longer than a certain length… but we really aren’t sure.

This might be a bug, but it would be nice to figure out some way of stopping this because having a reliable link from the PR description to the deploy is like candy heaven kitten rainbows

example deploy id: 5e94d41524db1900072ab63b

Hi, @thedamon, and welcome to the Netlify community site.

The length of the branch name is causing this issue. Long branch names cause a limit with the DNS specification to be reached.

There limit in question is the max length of a “label” as defined here:

https://tools.ietf.org/html/rfc1035#section-2.3.4

Quoting:

labels 63 octets or less

An “octet” is a single character for all practical purposes in this case. A “label” is any string between or before a literal . character in a domain name.

Taking, this domain name as the example:

foo.bar.example.com.

There are four labels above:

  • foo of length 3
  • bar of length 3
  • example of length 7
  • com of length 3

No one label can be longer than 63 characters. This is part of the specification for domain names (and not a limit being created by Netlify).

I believe this site name for the deploy above is 17 characters long.

Our systems always add two “-” characters between the branch name and the site name. So, this total length is 19 characters which leaves a remaining 44 character maximum length for branch names.

The branch name for that branch is 54 characters so the defined label is invalid and cannot be used. If a branch name is longer than 44 characters, the branch subdomain for the branch cannot be used.

Note, that max branch name length is dependent on the length of the site subdomain. If the site name was only 5 characters long, the max branch length would be 56 (which is 63 - 5 - 2). With a five character site name, this branch subdomain would the work like other branch subdomains.

If there are other questions about this, please let us know.

2 Likes