Thursday 12 January 2017

Sitecore -Getting IIS error pages outside the server instead of custom page not found/error page


Recently we faced an issue where custom page redirect on page not found/access denied was working fine inside the server but was showing IIS pages outside the server




One of my colleague Sufal came up with the fix for this which is as below

In web.config  - Add  <httpErrors errorMode="Detailed" /> just above </system.webServer> node.

or you can do the same directly in IIS -> Select your site -> error pages -> Edit feature settting -> Select detailed errors








Sunday 8 January 2017

Sitecore CD server went down - Exception- Tracker.Current is not initialized


Day before yesterday our one of the CD server went down with plenty of below exceptions


2108 03:18:13 ERROR Cannot create tracker.
Exception: System.IndexOutOfRangeException
Message: Index was outside the bounds of the array.
Source: mscorlib
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Sitecore.Analytics.Model.Framework.ModelFactory.GetConcreteType(Type elementType)
   at Sitecore.Analytics.Model.Framework.ModelFactory.CreateFacet(Type facetType)
   at Sitecore.Analytics.Model.Framework.Faceted.AddFacet(String name, Type type)
   at Sitecore.Analytics.Model.Framework.ModelFactory.CreateContact(ID id, IReadOnlyDictionary`2 facets)
   at Sitecore.Analytics.Data.ContactFactory.Create(ID id)
   at Sitecore.Analytics.Data.ContactRepository.CreateContact(Guid id)
   at Sitecore.Analytics.Pipelines.EnsureSessionContext.LoadContact.Process(InitializeTrackerArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Analytics.DefaultTracker.EnsureSessionContext()
   at Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process(CreateTrackerArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Analytics.Tracker.Initialize()

We did an iisreset which fixed the issue. We also reported the incident to Sitecore support to find the root cause . They confirmed it as a sitecore knwon issue and asked us to apply the patch following the below article

 https://kb.sitecore.net/articles/032518

The issue is related to the following method:

Sitecore.Analytics.Model.Framework.ModelFactory.GetConcreteType(Type elementType)
The above method use the "private static readonly IDictionary<Type, Type> typeMap;" internal class field which is initialized in static constructor as "Dictionary" collection:
static ModelFactory()
{
    typeMap = new Dictionary<Type, Type>();
}
However, since the above class is used from different threads the type of the collection, the patch replaces it with ConcurrentDictionary for correct threads synchronization.

Monday 2 January 2017

Sitecore Page editor keep on loading- Script error in require.js Experienceeditor.js not found

I recently faced this issue where my page editor was keep on loading. I found a JS error in console which says "Script error in require.js" , Experienceeditor.js not found. I had to create a temporary Experienceeditor.js file as below and had to place it in /sitecore/shell/client/Sitecore/ExperienceEditor folder.

define(["sitecore"], function (Sitecore) {
    return Sitecore.ExperienceEditor;
});

More details why this error happens and the root cause can be found in below post

http://www.awareweb.com/awareblog/11-16-15-retrofitsitecore8scripts

Happy New Year Everyone :)