Problema ao autenticar no Sitecore Commerce: problema e solução!

Recentemente eu trabalhei em um setup do Sitecore Commerce 8.2.1 e segui os passos do guia de instalação que você pode ler aqui.  A instalação foi concluída sem nenhum problema, mas quando comecei a testar o site eu me deparei com um erro ao tentar autenticar no site. O domínio do usuário que eu estava testando era o CommerceUsers. Eu tinha o mesmo problema, por exemplo, se eu tentasse alterar a senha do usuário no Gerenciador de Segurança do Sitecore(Security Manager). A mensagem de erro que eu recebia era:

 

The requested profile could not be retrieved because the key name provided does not exist or is not an indexed property.  The profile type is ‘UserObject’.  The key name provided is ‘GeneralInfo.ExternalID’.

 

A causa desse problema estava relacionada com a execução do comando de powershell InitializeCSSite que não deveria ter importado o perfil mas não o fez. Este é o primeiro passo que deve ser executado quando se esta na seção “Set up a Commerce Server site” do guia referido, como você pode ver aqui.

Para resolver esse problema eu tive que importar o arquivo de schema profile.xml manualmente seguindo as instruções contidas neste link.

O arquivo profile.xml é parte integrante do pacote de instalação do Storefront e fica localizado dentro da pasta website no caminho:

Website\SitecoreCommerce\Data\Profiles\Profiles.xml

Espero que ajude!

Ocorreu um problema ao instalar o Sitecore Commerce Server. Qual era e o que fiz para resolvê-lo

No post de hoje eu vou mostrar um erro interessante que eu tive ao reinstalar o Sitecore Commerce Server. Para a sua referência eu segui a documentação oficial de instalação do Sitecore Commerce, disponível aqui.

Vamos ao problema:

Eu havia instalado previamente o Sitecore Commerce e por razões que não interessam ao tema deste post eu decidi deletar a instância existente do Sitecore e reinstalá-la. E foi o que eu fiz. Eu fiz o setup do Sitecore e quando cheguei no passo de instalar os pacotes do Sitecore, mais especificamente o pacote Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.0.xxx.update eu tive o seguinte erro:

 

“Cannot open database “CFSolutionStorefrontSite_productcatalog” requested by the login. The login failed for user ‘DESKTOP-I0Q0N04\CSFndRuntimeUser’.”

A mensagem diz que o login falhou para o usuário DESKTOP-I0Q0N04\ CSFndRuntimeUser no banco de dados CFSolutionStorefrontSite_productcatalog.

E comecei a revisar as permissões do usuário CSFndRuntimeUser  que era um usuário administrador na instância do Windows que eu estava utilizando. Eu conseguia autenticar no SQL Server utilizando esse usuario. Como eu estava conseguindo fazer isso ficou claro que o problema era outro.

Enquanto eu investigava eu notei que quando você instala o Sitecore Commerce Server ele instala o banco de dados MSCS_Admin no Sql Server. Eu percebi também que a tabela Sites tinha dados com o nome do site que eu havia instalado anteriormente. Como eu estava utilizando o mesmo nome eu achei que poderia ter algo a ver. Para ver isso no sql server é so abrir o banco MSCS_Admin e rodar a query:

SELECT TOP 1000 *   FROM [MSCS_Admin].[dbo].[Sites]

Quando eu vi esse registro no banco eu decidi deletar o banco MSCS_Admin, já que era uma instância local e eu poderia fazer isso sem problemas, e instalar novamente o Sitecore Commerce Server. Após realizar isso e chegar no passo de instalar o pacote mencionado acima o problema foi solucionado.  Se deletar o banco não é uma opção para você, bom você ja sabe onde olhar 🙂 e por isso decidi escrever esse post para ajudar aqueles que possam estar meio perdidos com esse erro já que ele não ajuda muito a entender qual é o problema.

 

Reinstalling Sitecore Commerce Server caused an issue. What was it and how I fixed it.

In today’s post I will share with you an interesting issue I ran into while reinstalling Sitecore Commerce Server and what I did to address it. For your reference I have been following the official Sitecore Commerce installation guideline.

So here is my scenario:

I had previously installed Sitecore Commerce and for reasons that don’t really matter for this post I deleted the existing Sitecore instance and decided to reinstall it again.

And so I did. I setup Sitecore and when I got to the step of Installing the Sitecore update packages, more specifically the package Sitecore.Reference.Storefront.Powered.by.SitecoreCommerce.10.0.xxx.update

I got the following error message:

“Cannot open database “CFSolutionStorefrontSite_productcatalog” requested by the login. The login failed for user ‘DESKTOP-I0Q0N04\CSFndRuntimeUser’.”

And so I started double checking permissions for the CSFndRuntimeUser user which by the way, was an administrator on the Windows instance. I was able to authenticate on SQL Server using this same user. With that in mind I thought that this user should not have any sort of permissions issues so I knew was missing something.

As I kept investigating it I noticed that when you install Sitecore Commerce Server it will install on SQL Server the database MSCS_Admin. And looking further I noticed that on the Sites table there was the name of the Site I was reinstalling there(remember I am reinstalling an instance so I’m using the same name). To check that just open Sql Server Management Studio and run the following query on the MSCS_Admin database:

SELECT TOP 1000 *   FROM [MSCS_Admin].[dbo].[Sites]

When I saw that record I decided to delete the MSCS_Admin database altogether since this was a local installation and I could do that and reinstall Sitecore Commerce Server.
After deleting it, reinstalling Sitecore Commerce Server and trying again the installation of the update package I mentioned earlier it got rid of this error. If deleting it is not an option you know where to look for 🙂
So I decided to write this post as the error message I was getting was somewhat misleading so hoping to save whoever reads this some time 🙂

O comando Initialize-CSSite não funcionou ao instalar o Sitecore Commerce. O que era e como resolvi

Recentemente eu instalei uma instância do Sitecore Commerce utilizando Sitecore 8.2 update 1 utilizando a documentação oficial. Quando eu estava na seção de setar o Commerce Server eu segui as instruções abaixo:

“Open a PowerShell window and navigate to your Sitecore website directory. Run the Initialize-CSSite command.”

Em uma tradução livre diz “Abra o Powershell e navegue até a pasta website do Sitecore do seu website e rode o comando Initialize-CSSSite”.

E foi o que eu fiz, porém eu tive o seguinte erro, que eu inclusive postei no forum da Sitecore StackExchange: “A operação não pode ser executada porque essa instância do Commerce Server não foi configurada. Por favor rode o comando CSConfig.exe para configurar o Commerce Server”. Se voce estiver rodando o Windows em inglês a mensagem será “The operation cannot be performed because this Commerce Server instance has not been configured. Please run CSConfig.exe to configure Commerce Server”. Ao tentar rodar o comando CSConfig eu tive outra mensagem de erro “The term ‘CSConfig.exe’ is not recognized as the name of a cmdlet, function, script file, or operable program.”, que em linhas gerais quer dizer que o CSConfig não é um comando reconhecido do prompt de comando.

O fato de o comando CSConfig não ser reconhecido era uma indicação de que algo de errado havia acontecido na instalação do Commerce Server.

Após revisar os passos  que eu havia seguido, eu tentei desinstalar e instalar novamente o Commerce Server. Desta vez eu executei o instalador como administrador e notei que, no passo “Staging Service” do instalador, se eu selecionasse  qualquer outro usuário que aquele que eu estava logado e clicasse no botão ok, o instalador mostraria uma mensagem de que havia terminado(o que não parecia estar correto). Quando eu tentei instalar selecionando o usuário administrador padrão(pré-selecionado), o instalador mostrava a mensagem de progresso e depois de alguns segundos mostrava que havia terminado com sucesso.

Após isso, eu consegui rodar o comando Initialize-CSSite e continuar com a instalação do commerce server.

 

Initialize-CSSite command not working while installing Sitecore Commerce. What was it and how I fixed it

Recently I have set a Sitecore Commerce instance on Sitecore 8.2 update 1 following this guideline. When I got to the section of setting up the Commerce Server I ran into this instruction that suggests the following:

“Open a PowerShell window and navigate to your Sitecore website directory. Run the Initialize-CSSite command.”

And so I did it and got the following error which I posted at Sitecore StackExchange: “The operation cannot be performed because this Commerce Server instance has not been configured. Please run CSConfig.exe to configure Commerce Server”. When I ran the CSConfig.exe command I got another error “The term ‘CSConfig.exe’ is not recognized as the name of a cmdlet, function, script file, or operable program.”

The CSConfig not being recognized was an indication that something went wrong on the installation of the Commercer Server.

After troubleshooting I revisited the steps I had taken so far and tried uninstalling Commerce Server and installing it again. This time I installed with elevated privileges and noted that on the wizard step “Staging Service” if I selected any other users, even administrator users and clicked the ok button the installer would say installation complete(weird I know but that’s what I saw). When I tried again and this time selected the default account which was the one I logged into Windows the wizard would continue and displaying messages indicating progress. After a few seconds it would complete successfully.

After that I was able to run the Initialize-CSSSite command and resume with the installation of the commerce instance.

 

Sitecore 8: O atribute Hostname retorna vazio mesmo contendo um valor na configuração do site. O que pode ser?

Recentemente eu trabalhei em um projeto de Sitecore onde eu estava criando uma lista de sites dinamicamente assim:

sites = SiteManager.GetSites().Select(s => new SiteInfo(s.Properties)).ToList();

em mode de debug eu conseguia ver os valores do atributo hostname definidos corretamente para a configuração do site em questão. Mas ao construir o objeto ele não carregava o valor do hostname.

Eu verifiquei a pagina showconfig e vi a seguinte definição para o site website:

 

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/brands/clientname" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="Client.Brands.ClientName.Project.ClientName.config" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" hostname="clientname.dev.local|local.clientname.com"/>

Conforme respondido aqui, eu precisei mudar o atributo hostname para usar a letra maiúscula N assim: hostName, porque os atributos das definições dos sites respeitam maiúsculo e minúsculo. Apos realizar essa mudança ele começou a carregar corretamente o valor do atributo hostname. Você pode ler mais sobre os atributos das definições de sites aqui

 

Sitecore 8: Hostname not being retrieved for the website definition. What could be wrong?

Recently I have been working on a Sitecore project and I was building a list of sites dynamically like this:

sites = SiteManager.GetSites().Select(s => new SiteInfo(s.Properties)).ToList();

The problem is that at debug mode I could see the values of the hostname attributes for the website definition properly set. But it would not populate the property with the value from the config. in other words the value would return blank for the hostname attribute.

I checked the showconfig page and got the following definition:

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/brands/clientname" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" language="en" patch:source="Client.Brands.ClientName.Project.ClientName.config" itemwebapi.mode="Off" itemwebapi.access="ReadOnly" itemwebapi.allowanonymousaccess="false" enableItemLanguageFallback="false" enableFieldLanguageFallback="false" hostname="clientname.dev.local|local.clientname.com"/>

As pointed out here (thanks @MarasM) I needed to change the hostname to use the capital N as in hostName because the site attributes are case sensitive. Changing it made it to start working so I decided to post this to help out anyone who faces this issue.

You can read more about site attributes here.

Problemas ao sincronizar o Unicorn. Qual era e o como resolvi

Recentemente eu trabalhei em um projeto e eu tive um problema ao tentar sincronizar o Unicorn. Por conta disso resolvi escrever este post para compartilhar o aprendizado.

O Problema:

Eu tentava sincronizar, reserializar as minhas configurações mas sempre aparecia esta tela:

screen1

As definições das minhas configurações eram as seguintes(note a parte em negrito):

<configuration xmlns:patch=”http://www.sitecore.net/xmlconfig/”&gt;

<sitecore>

<unicorn>

<configurations>

<configuration name=”Feature.Navigation” description=”Feature Navigation” dependencies=”Foundation.Serialization” patch:after=”configuration[@name=’Foundation.Serialization’]”>

<targetDataStore physicalRootPath=”$(sourceFolder)\feature\navigation\serialization” type=”Rainbow.Storage.SerializationFileSystemDataStore, Rainbow” useDataCache=”false” singleInstance=”true” />

<predicate type=”Unicorn.Predicates.SerializationPresetPredicate, Unicorn” singleInstance=”true”>

<include name=”Feature.Navigation.Templates” database=”master” path=”/sitecore/templates/Feature/Navigation” />

<include name=”Feature.Navigation.Renderings” database=”master” path=”/sitecore/layout/renderings/Feature/Navigation” />

 <include name=”Feature.Navigation.Media” database=”master” path=”/sitecore/media library/Feature/Navigation” />

</predicate>

<roleDataStore type=”Unicorn.Roles.Data.FilesystemRoleDataStore, Unicorn.Roles” physicalRootPath=”$(sourceFolder)\feature\navigation\serialization\Feature.Navigation.Roles” singleInstance=”true”/>

<rolePredicate type=”Unicorn.Roles.RolePredicates.ConfigurationRolePredicate, Unicorn.Roles” singleInstance=”true”>

<include domain=”modules” pattern=”^Feature Navigation .*$” />

</rolePredicate>

</configuration>

</configurations>

</unicorn>

</sitecore>

</configuration>

A Solução

Após revisar as configurações, notei que elas pareciam estar corretas então eu revisei todos os includes definidos nas configurações. Ao fazer esse exercício eu percebi que na seção Media, havia um caminho que não existia na arvoré de conteúdo do Sitecore. Estava faltando a pasta Navigation no caminho sitecore/media library/Feature.

Quando eu criei esta pasta o Unicorn passou a sincronizar normalmente. Em outras palavras, se você não estiver conseguindo sincronizar, revise as suas configurações e os caminhos definidos no Sitecore, e veja se eles todos estão corretos.

Talvez isso seja útil e evite perdas de tempos no futuro para alguém 🙂

screen

Sync issue with Unicorn. What was it and how I fixed it.

Recently I have worked on a project and I had an issue syncing Unicorn and I decided to write this post to share what was it and how I fixed it.

The Problem:

I tried syncing, reserializing Unicorn but I would still keet getting this screen:

screen1

This is what my configuration looked like(Note the bolded section):

<configuration xmlns:patch=”http://www.sitecore.net/xmlconfig/”&gt;

<sitecore>

<unicorn>

<configurations>

<configuration name=”Feature.Navigation” description=”Feature Navigation” dependencies=”Foundation.Serialization” patch:after=”configuration[@name=’Foundation.Serialization’]”>

<targetDataStore physicalRootPath=”$(sourceFolder)\feature\navigation\serialization” type=”Rainbow.Storage.SerializationFileSystemDataStore, Rainbow” useDataCache=”false” singleInstance=”true” />

<predicate type=”Unicorn.Predicates.SerializationPresetPredicate, Unicorn” singleInstance=”true”>

<include name=”Feature.Navigation.Templates” database=”master” path=”/sitecore/templates/Feature/Navigation” />

<include name=”Feature.Navigation.Renderings” database=”master” path=”/sitecore/layout/renderings/Feature/Navigation” />

 <include name=”Feature.Navigation.Media” database=”master” path=”/sitecore/media library/Feature/Navigation” />

</predicate>

<roleDataStore type=”Unicorn.Roles.Data.FilesystemRoleDataStore, Unicorn.Roles” physicalRootPath=”$(sourceFolder)\feature\navigation\serialization\Feature.Navigation.Roles” singleInstance=”true”/>

<rolePredicate type=”Unicorn.Roles.RolePredicates.ConfigurationRolePredicate, Unicorn.Roles” singleInstance=”true”>

<include domain=”modules” pattern=”^Feature Navigation .*$” />

</rolePredicate>

</configuration>

</configurations>

</unicorn>

</sitecore>

</configuration>

The Solution

So after reviewing the configurations and validating that they seemed to be correct, I reviewed all the include mappins. So when I got to the Media section I noticed that the path defined on the configuration file didn’t exist within Sitecore’s content tree. It turned out that it was missing the Navigation folder under /sitecore/media library/Feature.

When I created it, unicorn started syncing properly again.  In other words, if you are not being able to sync double check if your configs and the paths underneath Sitecore  are all valid. This was the problem in my case. Hopefully this will save anyone sometime in the future.

screen

Non-default language is being used in Sitecore and is causing it to throw exceptions. What to do?

Recently I have been involved in a Sitecore project where in the implementation of the project a non-default language was created under system/languages called es-BR(Sitecore’s brazilian portuguese definition is pt-BR. I highly suggest that you use the standard notation but if you don’t have that option keep reading 😉 ).

When the publish mechanism got triggered Sitecore would throw the following exception:

Message: Item cannot be renamed to ‘es-BR’ as it is not a valid language name.

Source: Sitecore.Kernel

   at Sitecore.Diagnostics.Assert.IsTrue(Boolean condition, String message)

   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)

   at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)

   at Sitecore.Data.Engines.EngineCommand`2.RaiseExecuting(Boolean& cancelled)

   at Sitecore.Data.Engines.EngineCommand`2.CanExecute()

   at Sitecore.Data.Engines.EngineCommand`2.Execute()

   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)

   at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item)

   at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)

   at Sitecore.Data.Items.ItemEditing.EndEdit(Boolean updateStatistics, Boolean silent)

   at Sitecore.Data.Items.EditContext.Dispose()

   at Sitecore.Publishing.PublishHelper.CopyToTarget(Item sourceVersion)

   at Sitecore.Publishing.PublishHelper.PublishVersionToTarget(Item sourceVersion, Item targetItem, Boolean targetCreated)

   at Sitecore.Publishing.Pipelines.PublishItem.PerformAction.ExecuteAction(PublishItemContext context)

   at Sitecore.Publishing.Pipelines.PublishItem.PerformAction.Process(PublishItemContext context)

   at (Object , Object[] )

   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)

   at Sitecore.Publishing.Pipelines.PublishItem.PublishItemPipeline.Run(PublishItemContext context)

   at Sitecore.Support.Publishing.Pipelines.Publish.ProcessQueue.ProcessEntries(IEnumerable`1 entries, HashSet`1 publishedReferredItems, PublishContext context, Boolean processReferencedItems)

   at Sitecore.Support.Publishing.Pipelines.Publish.ProcessQueue.ProcessEntries(IEnumerable`1 entries, HashSet`1 publishedReferredItems, PublishContext context, Boolean processReferencedItems)

   at Sitecore.Support.Publishing.Pipelines.Publish.ProcessQueue.ProcessEntries(IEnumerable`1 entries, HashSet`1 publishedReferredItems, PublishContext context, Boolean processReferencedItems)

   at Sitecore.Support.Publishing.Pipelines.Publish.ProcessQueue.ProcessEntries(IEnumerable`1 entries, HashSet`1 publishedReferredItems, PublishContext context, Boolean processReferencedItems)

   at Sitecore.Support.Publishing.Pipelines.Publish.ProcessQueue.Process(PublishContext context)

Interestingly the same error would be throw if you would try to delete it from the content tree. While I was investigating how I could address this issue I noticed that the language would not appear on Sitecore’s Control Panel /Globalization menu, but it would show on the content tree.

What I had to do to fix that was to ensure that the language was registered in the Windows system. You could use the Language Registration tool available in the Sitecore’s marketplace. After that I had to add the node to \App_Config\LanguageDefinitions.config file:

<language id=”es” region=”BR” codepage=”65001″ encoding=”utf-8″ charset=”iso-8859-1″ icon=”flags/16×16/flag_Brazil.PNG” />