2

I am setting up habitat and I was going to installation instructions. When I run “default” task from Visual Studio 2015 Task Runner Explorer, I get the following error.

00:04:18] '05-Sync-Unicorn' errored after 25 ms[00:04:18] TypeError: Cannot read property '0' of undefined at C:\Projects\Habitat\scripts\unicorn.js:25:98 at Parser. (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:489:18) at emitOne (events.js:77:13) at Parser.emit (events.js:169:7) at Object.onclosetag (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:447:26) at emit (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:640:35) at emitNode (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:645:5) at closeTag (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:905:7) at Object.write (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:1452:13) at Parser.exports.Parser.Parser.parseString (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:508:31) [00:04:18] 'default' errored after 2.12 min[00:04:18] TypeError in plugin 'run-sequence(05-Sync-Unicorn)'Message: Cannot read property '0' of undefinedStack:TypeError: Cannot read property '0' of undefined at C:\Projects\Habitat\scripts\unicorn.js:25:98 at Parser. (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:489:18) at emitOne (events.js:77:13) at Parser.emit (events.js:169:7) at Object.onclosetag (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:447:26) at emit (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:640:35) at emitNode (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:645:5) at closeTag (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:905:7) at Object.write (C:\Projects\Habitat\node_modules\xml2js\node_modules\sax\lib\sax.js:1452:13) at Parser.exports.Parser.Parser.parseString (C:\Projects\Habitat\node_modules\xml2js\lib\xml2js.js:508:31)Process terminated with code 1.

Can someone help? Am I missing something?

If I go to unicorn.aspx and try to run Unicorn "Sync" on each project I get an error at http://habitat.dev.local/unicorn.aspx?verb=Sync&configuration=Foundation.Forms&log=Debug

[A] master:/sitecore/layout/Renderings/Modules/Web Forms for Marketers/Mvc Form (f2cca16d-7524-4e99-8ee0-78ff6394a3b3) 2 errors occurred during deserialization. Earlier log messages for items below should be ignored; an error occurred that was retried and failed to correct.master:/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Register an Outcome (90538392-5648-4326-b506-e1913ed1daa8)C:\projects\Habitat\src\Foundation\forms\serialization\Foundation.Forms.WffmActions.RegisterOutcome\Register an Outcome.yml> ParentItemNotFoundException: Exception of type 'Sitecore.Data.Serialization.Exceptions.ParentItemNotFoundException' was thrown.master:/sitecore/layout/Renderings/Modules/Web Forms for Marketers/Mvc Form (f2cca16d-7524-4e99-8ee0-78ff6394a3b3)C:\projects\Habitat\src\Foundation\forms\serialization\Foundation.Forms.Renderings.MvcForm\Mvc Form.yml> ParentItemNotFoundException: Exception of type 'Sitecore.Data.Serialization.Exceptions.ParentItemNotFoundException' was thrown. For full stack traces of each exception, see the Sitecore logs.

Thanks, Gowtham.

7
  • Can you elaborate on what you mean when you say that you "try to run each project"? Commented Mar 3, 2017 at 17:05
  • 1
    Do you have Webforms for Marketers installed? from the second error, it looks like it can't find certain files it expects from the module. Commented Mar 3, 2017 at 17:07
  • Zachary, I mean, when I go to unicorn.aspx and run unicorn sync for each project Commented Mar 3, 2017 at 17:24
  • Pat, I do have Webforms for Marketers installed. I just cloned the repo, I can I miss files? Commented Mar 3, 2017 at 17:26
  • @GowthamreddyTirumalareddy I think you should install WFFM module by yourself and run sync after that Commented Mar 3, 2017 at 21:34

2 Answers 2

1

The problem is that unicorn sync can't find your Shared key.

Does the config file exist in your website.

Please make sure this file is deployed in your website. It should be located at [Your Web Path]/App_config/Include/Unicorn/Unicorn.UI.config

https://github.com/Sitecore/Habitat/blob/efa05353abd956c58cfa269541a2a848dc55e356/src/Foundation/Serialization/code/App_Config/Include/Unicorn/Unicorn.UI.config#L17

    <authenticationProvider type="Unicorn.ControlPanel.Security.ChapAuthenticationProvider, Unicorn">
       <SharedSecret>749CABBC85EAD20CE55E2C6066F1BE375D2115696C8A8B24DB6ED1FD60613086</SharedSecret>
       <!-- Authentication challenges are stored in a Sitecore database. You can select which database here. No item installs/templates are required. -->
       <ChallengeDatabase>web</ChallengeDatabase>
       <!-- 
        Writes the reason why failed automated tool authentications failed to the Sitecore logs.
        Will result in writing your shared secret to the logs as part of the signature base, so you can disable it if you wish.
       -->
       <WriteAuthFailuresToLog>false</WriteAuthFailuresToLog>
    </authenticationProvider>

Is your gulp config set to your site location

You need to make sure a few setting are3 right. In the gulp-config.js in the root of the project, make sure instanceRoot and websiteRoot are properly set. https://github.com/Sitecore/Habitat/blob/78f9b95d133424b30e4d4ecfc2b1c7e1c53be07f/gulp-config.js

var instanceRoot = "C:\\websites\\Habitat.dev.local";
var config = {
websiteRoot: instanceRoot + "\\Website",
sitecoreLibraries: instanceRoot + "\\Website\\bin",
licensePath: instanceRoot + "\\Data\\license.xml",
solutionName: "Habitat",
buildConfiguration: "Debug",
runCleanBuilds: false
};

Gulp file looks for your config

In the gulpfile.js (the gulp task) is specifically looks for the config file with the shared key with the js configs set above. https://github.com/Sitecore/Habitat/blob/78f9b95d133424b30e4d4ecfc2b1c7e1c53be07f/gulpfile.js#L84

You can see below that it is specifically looking for the config file. options.authenticationConfigFile = config.websiteRoot + "/App_config/Include/Unicorn/Unicorn.UI.config";

Where your error is

Your error is here and it tries to parse the config file https://github.com/Sitecore/Habitat/blob/efa05353abd956c58cfa269541a2a848dc55e356/scripts/unicorn.js#L25

secret = result.configuration.sitecore[0].unicorn[0].authenticationProvider[0].SharedSecret[0];

5
  • I made sure that I have the unicorn config file in the location, made sure gulp config is pointing to sight website root and I still get struck on unicorn sync. Commented Mar 8, 2017 at 20:23
  • actually now it just freezes at sync step . Scipt doesn't move from [20:22:03] Starting '05-Sync-Unicorn'... Commented Mar 8, 2017 at 20:57
  • It spits out the unicorn log while it is running. Any errors in the console?
    – Chris Auer
    Commented Mar 8, 2017 at 23:05
  • no, I do not see anything. I added the following logs to gulp.task("05-Sync-Unicorn", function (callback) to check if the "options" are right and they are going to right locations. util.log("options.siteHostName: " + options.siteHostName); util.log("options.authenticationConfigFile: " + options.authenticationConfigFile); Commented Mar 8, 2017 at 23:42
  • This is what happens C:\projects\Habitat> cmd.exe /c gulp -b "C:\projects\Habitat" --color --gulpfile "C:\projects\Habitat\Gulpfile.js" 05-Sync-Unicorn [23:44:48] Using gulpfile C:\projects\Habitat\Gulpfile.js [23:44:48] Starting '05-Sync-Unicorn'... [23:44:48] options.siteHostName: habitat.dev.local [23:44:48] options.authenticationConfigFile: C:\websites\Habitat.dev.local\Website\App_config\Include\Unicorn\Unicorn.UI.config It just sits there Commented Mar 8, 2017 at 23:45
0

You should make the Sitecore variable below in z.Habitat.DevSettings.config correct at your machine

<sc.variable name="sourceFolder" value="C:\projects\Habitat\src" />
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.