Wp-calypso: "Create a site": underscore causes error

Created on 31 Jul 2017  路  3Comments  路  Source: Automattic/wp-calypso

I was creating a test account and added an underscore to it. This popped u.p an error saying "Sorry, there was a problem processing your request. Please try again in a few minutes." I did find that when I omitted the underscore, the error goes away and the page behaves normally.

I did check the JS console and didn't see any errors. And I also looked at the Redux actions and didn't find a smoking gun there either.

Steps to reproduce

  1. Starting at URL: https://wordpress.com/start/domains
  2. Type a name with an underscore
  3. View the error.
  4. Replace the underscore with a dash.
  5. View the application behaving normally.

What I expected

create_a_site_ _wordpress_com

What happened instead

create_a_site_ _wordpress_com

Browser / OS version

OSX Chrome Version 59.0.3071.115 (Official Build) (64-bit)

Domains NUX Purchases [Type] Bug

Most helpful comment

All 3 comments

I started to dig into this but seems I haven't found the exact problem yet. Some debugging:

Inside the <DomainRegistrationSuggestion> component, seems that if the domain is valid we'll move onto the next signup step, if doesn't, the warning is triggered.

This seemed to be coming from the .match(regex) here: https://github.com/Automattic/wp-calypso/blob/f0b2e14d149cc7b03f9c55f5be2f8d90a7d5226b/client/components/domains/register-domain-step/index.jsx#L346

But on my testing I changed the current regular expression for a simple /([A-Za-z])+/ and the error we get now is different.

For example the domain yourdomain- worked with the original regular expression, but doesn't work now as is not valid:

Sorry, yourdomain- does not appear to be a valid domain name.

screen shot 2017-09-01 at 14 50 15

However the underlying error is still there, as if I change from yourdomain- to yourdomain_ , the error message changes as per the bug report:

Sorry, there was a problem processing your request. Please try again in a few minutes.

screen shot 2017-09-01 at 14 56 23

This comes from getAvailabilityNotice( domain, error ) here: https://github.com/Automattic/wp-calypso/blob/a70587157b33783ba4d5e0e4a1e136680d459d51/client/lib/domains/registration/availability-messages.js#L14

The difference is the case:

  • case domainAvailability.INVALID: Sorry, yourdomain- does not appear to be a valid domain name.
  • case default: Sorry, there was a problem processing your request. Please try again in a few minutes.

Thanks for that in-depth investigation, @iamgabrielma 馃檱 And especially for adding the Domains label - without it, no one gets pinged and this issue went by unnoticed (of course, kudos to @coderkevin, for bringing it up in the first place 馃榿).
I haven't tested yet, but it'd seem that we're not handling _ properly on the backend. A quickfix would be to replace all occurrences of _ with - and send that to the backend.

As for trailing - or _ - _ is of course not allowed in domains, - is, but only if it's not at the beginning or end.

Was this page helpful?
0 / 5 - 0 ratings