Saturday 22 June 2019

Sitecore 9.1 Experience Editor stopped working after code deployment


Hello Sitecore fellows,

As we are in a process of upgrading our version to Sitecore 9.1, we are facing new challenges as a part of the journey.

That said, a very good quote which says.

Enjoy the journey and try to get better every day. And don’t lose the passion and the love for what you do.

We were able to successfully deploy code to our new Sitecore 9.1 (initial release) and most of the things went well except one and which was a big one “Experience Editor”.

When we tried to add any component to a page in Experience Editor with its data source item it started to give us a JavaScript alert in browser as well as error in console.

This was something that I haven’t faced before and looking at the console error it looked to be a generic error.

The error says,

“could not find the rendering in the Html loaded from the server”

I Googled this error and found


We raised a support ticket for better understanding of the issue, and they asked us to capture the fiddler session of the same.

Sitecore Support came up with an answer as below,

“I believe the issue lies within GET vs POST request. In Sitecore 9.0 onwards, Experience Editor architecture was changed and part of this included some requests making a POST request which initially were making a GET request. 

I compared the "Palette.aspx" call from your fiddler session to mine. In the response of this POST call, in yours, there is no element with ' id="r_****" ', this implies that the POST request was not handled on controller side if I am not mistaken. 

I would encourage checking your Controller handling and change to handle POST request rather than GET. “

Ours is a Multisite Solution and we have many re-usable components which are used across the sites and it seemed to be a very time-consuming process to check each component in the solution.

But for every problem there is a Solution and we found one.

Suddenly for one of the Site which had fewer content pages, Experience Editor was working. But for our 2 main sites it was not.

As mentioned previously we have components which are re-usable across all the Sites, I decided to use a trick.

The home page for all the Sites were almost identical except one component.
It was a Search Component which was different from the one where the Experience Editor was working, and it was a global component which is used on all the pages.

I removed the search component from the page and tried to add a component and it worked.

I was successfully able to add a component to the page.

Now what's there in that component which is not allowing the experience editor to function?

In the POST request at the end of the code it was basically doing Redirect to a particular URL and that was causing conflict with the Experience Editor POST method.

The Solution was simple. I added below line of code and was able to fix the issue

if (!Sitecore.Context.PageMode.IsExperienceEditorEditing)
                return Redirect(redirectUrl);

Phewwww…. and the Experience Editor started working.


Note : Thanks to Yogini Zope for Identifying that it worked for one of the sites.


Wednesday 12 June 2019

Sitecore 9.1 : Access denied error when trying to open Sitecore admin page without login when identity server is disabled



Hello Sitecore Devs,

We have a Sitecore 9.1 instance (initial release) where Identity Server is disabled.

To know more about Identity server follow this link : 


If you want to disable identity Server for some reason, Sitecore OOTB provides 2 disabler configs namely,

Sitecore.Owin.Authentication.Disabler.config
Sitecore.Owin.Authentication.IdentityServer.Disabler.config

I found one strange thing on my Sitecore instance after the identity server is disabled.

Whenever I tried to open any admin page (e.g. http://<yourhostname>/sitecore/admin) without login, instead of redirecting me to the login page it was showing me access denied error page.

This was something unexpected. So, I raised a Support ticket with Sitecore to understand this behavior.

Sitecore Support accepted this as a bug in Sitecore 9.1.

Now what’s the solution?

As per Sitecore they would no longer provide patches for Sitecore 9.1 or later versions.

Check the Sitecore KB article on this: https://kb.sitecore.net/articles/077333

But they were kind on me. They did mention a workaround for this.
  • Create an item under the item '/sitecore/system/Aliases' using Alias item
  • Insert an external link. For example, create the admin item with the link http://<HostName>/sitecore/login?ReturnUrl=%2fsitecore%2fadmin%2f
  • The shell item - with the link http://<HostName>/sitecore/login
  • Publish your items.

View below screencast to reproduce and fix the issue: https://www.screencast.com/t/koGEsQDXszn

That’s it for now!!!

Tuesday 9 April 2019

Sitecore XP 9.1 – Marketing Automation/Processing Engine Services not getting started automatically after installation

Hello Devs,

After installing Sitecore 9.1 (Development/Scaled) environment you might face an issue where Marketing Automation/Processing Engine services doesn’t get start automatically.

First Step - Try starting them manually. If they start you are good there.
If not follow below stack overflow links for troubleshooting:


Still facing issues while trying to start services?

Follow below steps to troubleshoot:

1.Check the XConnect site in the IIS to verify whether valid certificate is associated with the XConnect site.
    
     2.Check whether XConnect loads successfully in browser with a valid certificate  associated.
    
     3.Verify the thumbprint value of the certificate associated with the XConnect site with the below mentioned locations. It should be same, if not update thumbprint values to match with the Certificate thumbprint associated with the XConnect site.

Sitename.XConnect\app_config\AppSettings.config
Sitename.XConnect\App_Data\jobs\continuous\AutomationEngine\App_Config\ConnectionStrings.config
Sitename.XConnect\App_Data\jobs\continuous\ProcessingEngine\App_Config\ConnectionStrings.config

Once all this is done try to re-start the machine and check whether the services started automatically. If not, try to start them manually.

Hope this helps!!!

Monday 25 March 2019

Sitecore XP 9.1 Scaled: Experience Analytics not working


Currently we are upgrading our Sitecore Solution to Sitecore XP 9.1 (initial release) and we are setting up Scaled environment as :

Read more about (Scaling Scenarios)

(CM/CD/PRC/RPT) -1
(XConnect )– 1
(Solr )- 1
(Proxy) – 1

After the Installation was completed and post installation steps were performed we used below testing matrix to verify the Vanilla 9.1 instance.

#
Checklist
Status
1
Verify Solr is running on the Solr server as Windows service
Passed
2
Verify that Sitecore loads on {url}/sitecore/login
Passed
3
Verify Sitecore cache is working at {url}/sitecore/admin/cache.aspx
Passed
4
Verify Sitecore showconfig page is loading at {url}/sitecore/admin/showconfig.aspx
Passed
5
Verify if you can build the indexes from Sitecore control Panel
Passed
6
Verify if xConnect loads 
Passed
7
Verify if Marketing Automation windows service is running
Failed
8
Verify if Processing Engine windows service is running
Passed
9
Verify if Search-IndexWorker windows service is running
Passed
10
Verify if log files are generating properly. 
Passed
12
Verify if Sitecore Content Editor loads
Passed
13
Verify the IIS user has access rights to the Web root 
Passed
14
Verify if Analytics data is getting updated on Dashboard
Failed




All the above steps got passed except one and that was Sitecore Analytics.



First thing we did was checked the log files for the CM environment and we found errors related to the analytics and it was “The certificate was not found“.
Exception: System.InvalidOperationExceptionMessage: The certificate was not found.Source: Sitecore.Xdb.Common.Web   at Sitecore.Xdb.Common.Web.CertificateWebRequestHandlerModifier.Process(HttpClientHandler handler)
We had already checked that Xconnect was getting loaded successfully.


We checked for the Marketing Automation, Index worker and Processing engine service whether they were running and found out that the Marketing Automation service was not running.

We checked the connection strings from CM and Xconnect servers to be sure that a Valid thumbprint is associated wherever required and found out that in one place for the Xconnect server the Thumbprint was wrong. We updated the thumbprint and the Marketing Automation service got started.

We thought that might solve our issue but No, my thought was wrong. Still same error in logs.

We checked the IIS for the Xconnect server and verified whether a Valid Certificate was attached on the IIS for Xconnect.

We checked IIS app pool user rights were assigned to the Xconnect certificate and it was there.

Next step, We tried to load the Xonnect site from the CM server and it showed me an invalid certificate exception (If you are not able to access Xconnect from CM Server make sure you add host entry for Xconnect on CM). So, my doubt was confirmed that CM server was somehow not able to communicate with the Xconnect server.

Now we imported the Xconnect certificate to the CM server’s Local Computer/Personal/Certificates folder to see if it might solve the issue and to our surprise, the error vanished from the logs.

We tried to the hit the Xconnect site from the CM server again. The certificate exception was gone now and Xconnect loaded with the Valid certificate attached to it.

This was something we figured by try and error. I opened a Sitecore support ticket to understand this scenario and they also mentioned that the certificate should be present on both the Machines (i.e CM and Xconnect) in our case.

Good reads :

https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/enable-client-certificate-authentication.html

https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/configure-connections-strings.html

https://doc.sitecore.com/developers/91/sitecore-experience-management/en/the-client-certificate-for-sitecore-deployments.html









Thursday 28 February 2019

Error on Sitecore 9.0.2 Installation on Virtual Machine: Command sqlcmd returned a non-zero exit code

One of my Colleague faced an issue while installing Sitecore 9.0.2 on Virtual Machine (See below screenshot).














Quick Fix: Download and Install MicrosoftODBC Driver 17 for SQL Server and the above installation error would vanish.

That’s it for now !!!

Monday 25 February 2019

Remove un-used templates from Sitecore


Hello Devs,

Currently I was working on Template clean-up tasks where we had to remove un-used/unreferenced templates from Sitecore.

While removing the templates, I faced one issue where I was not able to delete some of the templates and was getting below message:



I checked whether template is being referred somewhere using the links command and it was referring to the Standard Values of the template.






I removed the Standard Values of the Template but still no success. The reason might be it would be still referenced somewhere in Sublayouts/Base Templates/Data Source Templates etc.

If you are sure that template is not being used, Sitecore has one hidden utility which can make your life easier.


Sitecore admin page: <yoursiteurl>/sitecore/admin/dbbrowser.aspx

It displays the view of the Sitecore database. Its also very light weight as it doesn’t load the sub-items by-default. This doesn’t run the normal validations from the main content editor and allows you to delete the template without any validations.

Finally, I was able to delete templates which I was sure not being used.

Caution:  The Biggest drawback of this tool is you can’t restore deleted items as it doesn’t store it in Recycle bin.