Sitecore 9.1 – Sitecore Analytics is not working

Dear Sitecore Family,

How are you?

As mentioned in my previous post we saw how we solved the problem that we faced while getting the Marketing Automation Service to start and how we solved it. In case you missed, do check it here.

The next challenge was Sitecore Analytics not working – which I would say was major one!

Challenge: Sitecore Analytics Not Working

As usual, first and foremost, we did what any Sitecore developer would do, i.e. checking the Sitecore Logs.

We found the following error in the log files:

5756 11:32:31 ERROR Exception when executing agent aggregation/pathAnalyzerLiveAgent
Exception: Sitecore.XConnect.XdbCollectionUnavailableException
Message: An error occurred while sending the request.
Source: Sitecore.Xdb.Common.Web
at Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock[TResult](Func`1 taskFactory)
at Sitecore.XConnect.Client.XConnectSynchronousExtensions.SuspendContextLock(Func`1 taskFactory)
at Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.Initialize(XmlNode configNode)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient(String clientConfigPath)
at Sitecore.Analytics.Aggregation.XConnect.DefaultXdbContextFactory.CreateReadOnly()
at Sitecore.PathAnalyzer.Processing.Agents.TreeAggregatorAgent.Execute()
at Sitecore.Analytics.Core.BackgroundService.Run()

Nested Exception

Exception: System.InvalidOperationException
Message: The certificate was not found. Store: My, Location: LocalMachine, FindType: FindByThumbprint, FindValue: SOMETHING, InvalidAllowed: False.
Source: Sitecore.Xdb.Common.Web
at Sitecore.Xdb.Common.Web.CertificateHttpClientHandlerModifier.Process(HttpClientHandler handler)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateRequestHandler()
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateClient()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__41.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteGetAsync>d__36.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__4.MoveNext()

Now, we know that XConnect runs on SSL, while for the Sitecore CMS this is not mandatory. Again, we had checked and the xConnect was running as required.

So what could it be?

Also, when we went to the Experience Analytics in the Sitecore Launchpad, we found the following error in the Console of the browser:

Solution:

Now, lets discuss a brief about our architecture real quick.

We have installed Sitecore 9.1 XP Single instance for our lower (QA Environment), where we have Sitecore (CM/CD/PRC/RPT) on one machine while XConnect on the other.

We suddenly had a Eureka Moment! We felt, at that point, what if we need to add the XConnect Certificate to the CM Server?

So we just went ahead and added the XConnect Certificate to the CM Server in MMC.

Next, we executed the following two commands.


Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject}

We found one result in the above command, hence we executed the second one:


Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject} | Move-Item -Destination Cert:\LocalMachine\CA

What does the above two commands do?

The first one, checks for any non-self-signed certificates in Personal location of MMC

If you found a result item from the first script then we need to execute the second PowerShell command to move these non-self-signed certificates into the Intermediate Certification Authorities store.

We did the IIS Reset and checked the LaunchPad and the Analytics was back up.

And the graph in Experience Analytics as well:

To verify if the Sitecore Analytics started working due to the certificate we added, we just went back and deleted the certificate and saw the issue reoccur.

So we were sure that it was due to the Certificate that we added it to the CM Server.

Next up, I will share a list of checkpoints or sort of a checklist that we followed to check for whether the Plain Sitecore 9.1 instance is working as required or not.

So we think, that during installation of XP Single on the same machine, the reason this doesnt fail is because the certificate is already available in the Certificate Store and the Sitecore instance does use that certificate for communication purposes.

I would say, it was a great learning to know this, because if we didn’t have this setup, we would never have understood this concept until we setup a XP Scaled Instance!

Credits:

To my fellow team mates – Mahek Chaniyara, Yogini Zope and Greg Brown – for working with me and achieving success. 🙂

References:

Happy Sitecore Troubleshooting! 🙂

Advertisements

6 thoughts on “Sitecore 9.1 – Sitecore Analytics is not working

  1. Hi Varun,

    I am facing same issues. All my instances are in azure PAAS. Do you have any solution for that?

    Regards,
    Bharath

    1. Hi Bharath,

      Good to check Sitecore logs, they provide most of the information.
      We can chat on Sitecore Community chat – let me know if I can be of any help.

      Regards,
      Varun Shringarpure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.