1

Background: I created a lot of JSS sites while I was learning Sitecore JSS with React integration. Also, I erased them. Currently, if I attempt to create a new JSS site, the CMS indicates that "A site with that name already exists" as a validation problem.

Problem: Even while I don't see this to be a show-stopper, anyone could experience this problem. I'm trying to come up with a solution as a result. The Popup's screen excerpt and error message are provided below. enter image description here

thanks in advance.

1
  • Is site name shown in SXA Site Manager or /sitecore/admin/showconfig.aspx ?
    – Kamil C
    Mar 21, 2023 at 14:04

2 Answers 2

1

I came accross the same issue. If you ran jss deploy config command earlier for that site, try removing the relevant files copied under \App_Config\include\zzz\. I was able to create a new site with the same name used in the past after doing this.

0

Sitecore SXA and JSS site creation is managed through Powershell scripts. Here is the Powershell script location that populates this dialogue

/sitecore/system/Modules/PowerShell/Script Library/JSS SXA/Scaffolding/Functions/Get-NewJSSSiteDialog

If you check the code to validate the site, you will find something like this.

if ($forbiddenSiteNames -contains $siteName -eq $true) 
{
    $variables.siteName.Error = $([Sitecore.Globalization.Translate]::Text([Sitecore.XA.Foundation.Scaffolding.Texts]::SiteWithThatNameAlreadyExists))
    continue
}

-ValidatorParameters @{forbiddenSiteNames = (Get-ForbiddenSiteName $SiteLocation)}

Now, if you will see how it gets the forbiddenSiteNames, you will get the code like this.

$siteItemTemplateId = [Sitecore.XA.Foundation.Multisite.Templates+_BaseSiteRoot]::ID.ToString()
$forbiddenSiteNames = [Sitecore.Sites.SiteManager]::GetSites() | % {$_.Name}
$SiteLocation.Children | ? { [Sitecore.Data.Managers.TemplateManager]::GetTemplate($_).InheritsFrom($siteItemTemplateId) } | % { $forbiddenSiteNames += $_.Name }
$forbiddenSiteNames | Select-Object -Unique

Try debugging the script in your Powershell window and you will see the list of all sites and then check on which one it is failing and the validation is getting failed.

Hope this will give you some context to identify your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.