Habitat on Sitecore 9.1 – Resolve Unicorn Sync Issues

What Issue I faced:

Today I have setup Sitecore Experience Platform 9.1 Update-1 along with the corresponding Habitat solution from github:
I got stuck in the step of Unicorn-Sync as it was showing the same message over a long period of time and I dint see anything in logs.

I tried with the corresponding Unicorn sync Url: http://demosc91.sc/unicorn.aspx and then popped up – unfriendly Error message

Steps I did to resolve?

  1. Update Unicorn package in Habitat solution to V4.0.7
    • Go to Project: Sitecore.Foundation.Serialization
    • Manage Nuget Package : Update Unicorn to V4.0.7 : this change is required as Sitecore 9.1 uses identity server for authorization .
    • I was having issues with the update , So I uninstalled all Unicorn and Rainbow references from this project(Unicorn, Unicorn.Core, Unicorn.Role,Unicorn.Roles.Core,Unicorn.Users, Unicorn.Users.Core, Rainbow, Rainbow.Core
    • Post I have installed Unicorn V4.0.7 in this same project.
  2. Add a patch file : z.unicornhotfix.config Sitecore 9.1 uses identity server for authorization Update Unicorn package in Habitat solution to V4.0.7
    • Go to Project: Sitecore.Foundation.Serialization
    • Manage Nuget Package : Update Unicorn to V4.0.7 : this change is required as
    • I was having issues with the update , So I uninstalled below all Unicorn and Rainbow references from this project(Unicorn, Unicorn.Core, Unicorn.Role,Unicorn.Roles.Core,Unicorn.Users, Unicorn.Users.Core, Rainbow, Rainbow.Core
    • Post I have installed Unicorn V4.0.7 in this same project.
  3. Add a patch file : z.unicornhotfix.config
z.unicornhotfix.config
<configuration>
    <sitecore>
        <pipelines>
            <owin.cookieAuthentication.validateIdentity>
                <processor type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.ValidateSiteNeutralPaths, Sitecore.Owin.Authentication">
                    <siteNeutralPaths hint="list">
                        <path hint="unicorn">/unicorn.aspx</path>
                    </siteNeutralPaths>
                </processor>
            </owin.cookieAuthentication.validateIdentity>
        </pipelines>
    </sitecore>
</configuration>

3. Publish the Habitat Solution and go to Unicorn.aspx page:- http://demosc91.sc/unicorn.aspx

Error: Unable to resolve type ‘unicorn.deserialization.unicorndeserializer, unicorn’ on dependency config node ‘deserializer’


4. Above Error popped as I missed to update the Unicorn.config file post upgrade of Unicorn 4.0.7

  • Go to Project: Sitecore.Foundation.Serialization – App_Config : Inlcude : Unicorn : Unicorn.config
  • Add new entries for deserializer and deserializerLogger .I have commented out the existing ones.
 <!-- <deserializer type="Unicorn.Deserialization.UnicornDeserializer, Unicorn" singleInstance="true" /> -->
<!-- <deserializerLogger type="Unicorn.Deserialization.DefaultDeserializerLogger, Unicorn" singleInstance="true"/> -->
<deserializer type="Unicorn.Deserialization.UnicornDeserializer, Unicorn" ignoreBranchId="true" singleInstance="true" />
<deserializerLogger type="Unicorn.Deserialization.DefaultDeserializerLogger, Unicorn" singleInstance="true"/>

Post above update – Unicorn.aspx is back with Bang: http://demosc91.sc/unicorn.aspx

Happy Sitecoring !!