Sitecore 8.1 Update 3 Error Loading Hook - sitecore

I'm upgrading my site from 8.1 initil release to sitecore 8.1 update 3 and when trying to open the index manager I have the following error:
21396 2016:08:25 11:07:39 ERROR Error loading hook: <hook type="Sitecore.ContentSearch.Hooks.Initializer, Sitecore.ContentSearch" patch:source="Sitecore.ContentSearch.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" />
Exception: Sitecore.Exceptions.ConfigurationException
Message: Could not create instance of type: System.String. No matching constructor was found.
Source: Sitecore.Kernel
at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert)
at Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration()
at Sitecore.ContentSearch.Hooks.Initializer.Initialize()
at Sitecore.Events.Hooks.HookManager.LoadAll()
Any ideas how to solve this error?

Based on the error, it sounds like there is an issue with the initialization hook. If you temporarily comment out the<hook type="Sitecore.ContentSearch.Hooks.Initializer, Sitecore.ContentSearch" /> line (usually somewhere around line 64) in /App_Config/Sitecore.ContentSearch.config does the error go away, or do you get a different error?

The problem was a wrong configuration with the file "Sitecore.ListManagement.Lucene.IndexConfiguration.config" in which the following line was in incorrect location
<field fieldName="segmentation" storageType="YES" indexType="NOT_ANALYZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />

Related

makeExecutableSchema of graphql-tools failes with AWSDateTime in the schema

I am using graphql-tools for mocking the response from Appsync and it is failing for schema which has AWSDateTime as datatype of some fields. Following is the error I am getting:
Uncaught Error: Unknown type "AWSDateTime".
Unknown type "AWSDateTime".
Unknown type "AWSDateTime".
And this is code for which it is failing:
import { SchemaLink } from "apollo-link-schema";
import { makeExecutableSchema, addMockFunctionsToSchema } from "graphql-tools";
const typeDefs = `
type Dates {
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
type Query {
getDates(id: ID!): Dates
}`;
const schema = makeExecutableSchema({ typeDefs });
Any idea how can I fix this issue? I know AWSDateTime is scalar type defined specially for appsync, so it may not work. But is there any workaround. With ApolloLink client, it works just fine.
Every scalar you use, with the exception of the 5 built-in scalars, has to be explicitly defined inside your schema. This is a two-step process:
First, add the type definition:
scalar AWSDateTime
Second, provide a GraphQLScalarType object, which encapsulates the parsing and serialization logic of the scalar. With makeExecutableSchema, this is provided through the resolver map.
const resolvers = {
...
AWSDateTime: new GraphQLScalarType({ ... }),
}
See the docs for additional details. If the serialization and parsing logic doesn't really matter because this is just for mocking anyway, then you could use the methods of an existing scalar, like String.
const resolvers = {
...
AWSDateTime: new GraphQLScalarType({
name: 'AWSDateTime',
parseValue: GraphQLString.parseValue,
parseLiteral: GraphQLString.parseLiteral,
serialize: GraphQLString.serialize,
}),
}

Sitecore 8.1- Could not resolve type name: Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics

I'm using sitecore 8.1, .net mvc 4.5.2. The below error is shown when I access to the site.
Here is my setting at sitecode.analytics.config:
<contactRepository type="Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics" singleInstance="true" />
Is there anything missing? how can I bypass the error?
Thanks
Could not resolve type name: Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Could not resolve type name: Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Exception: Could not resolve type name: Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
Sitecore.Diagnostics.Error.Raise(String error, String method) +108
Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) +230
Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +41
Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +100
Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +451
Sitecore.Configuration.Factory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert) +91
Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +81
Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +82
Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +416
Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +198
Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +451
Sitecore.Configuration.Factory.CreateObject(String configPath, Boolean assert) +38
Sitecore.Analytics.Pipelines.Loader.InitializeAutomation.Process(PipelineArgs args) +50
(Object , Object[] ) +56
Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters) +36
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +158
Sitecore.Nexus.Web.HttpModule.Application_Start() +165
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +498
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not resolve type name: Sitecore.Analytics.Data.ContactRepository, Sitecore.Analytics (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947444
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
I have tried to create a new sitecore 8.1 instance and then copy and paste the config and dll (starts with "Sitecode.Analystics") into the project. It works
It looks like Sitecore.Analytics.Data dll file is not in your bin folder.
Make sure that all the Sitecore dll files are inside your website bin folder including Sitecore.Analytics.Data.

Ember/RSVP Promise value changes when passed to resolve()

I am trying to wrap a jQuery AJAX request in a Ember RSVP promise, and I have this issue where the value I send to the resolve function (which is the jqXHR parameter) changes from object to string.
The code for doing the request + creating the request is as follows:
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax([URL], {
type: 'POST',
dataType: 'text'
}).then((data, textStatus, jqXHR) => {
console.log(jqXHR);
resolve(jqXHR);
}, (jqXHR, textStatus, errorThrown) => {
resolve(jqXHR);
});
});
And in my controller, I handle the request like this:
promise.then((response) => {
console.log(response);
if (response.status === 200) {
something...
} else {
something else...
}
receipt.set('busy', false);
});
Now, from the basic (and probably flawed) comprehension I have of RSVP.Promise, the resolve(jqXHR) line should send the jqXHR object as parameter to the callback, right?
Problem is, when I print the response I get in the console, all I get is 200 success, which is the body of the HTTP request I do.
However, when I print the jqXHR before resolving it, it correctly prints the whole object:
Object {readyState: 4, responseText: "200 success", status: 200, statusText: "OK"}
So why is this happening? Is Ember doing some wierd black magic and converts the jqXHR object to string? Or is the data string being sent in lieu of the jqXHR object I am expecting?
Thanks!
Got it!
Alright, so apparently rsvp.js checks if the object sent to the resolve method is 'thenable' (read then-able), i.e. if it contains a then method.
If it is 'thenable', it will execute the then method of the object, take its first argument (only) and take it as the fulfilled value. This little magic allows chaining resolves but doesn't work very well with callbacks that take multiple arguments.
So in my case, I was sending jqXHR to be resolved, which does contain a then method (according to the jQuery documentation). RSVP then tried to fulfill the jqXHR object as a promise, and returned the first argument of the resolve callback.
Now, the signature for the jqXHR resolve callback is function(data, textStatus, jqXHR);, which is why the object sent to MY callback was not jqXHR as I expected, but was the first argument of the jqXHR resolve callback: data.
TL;DR: Check if the object you try to resolve your promise with has a then method, because it WILL be executed.

How to check promise value and property updated in promise but not returned with chai-as-promised

I have a promise which checks if I'm authorized or not (returning true or false).
Within that promise, when authorization is false, I'm also adding the 403 statusCode to the response object that I pass as a parameter.
I'm testing the result of my promise with chai-as-promised but I didn't manage to find a way to also test the status code of the response after the promise is resolved.
var result = authorizePromise(request, response);
return expect(result).to.eventually.equal(false).and(response.statusCode.should.be(403));
the response should be used in parent scope.
and the assertion should be called after the promise is ready
so it should be a function that called after.
your code example .and(response.statusCode.should.be(403)); runs the assertion instant, and passes it as parameter to .and() it does not wait for the promise.
*You can use .andinstead of .then too.
var response = {};
var resultPromise = authorizePromise(request, response);
return expect(resultPromise).to.eventually.equal(false)
.then(function(){return response.statusCode.should.be(403)})

WFFM Email validation causing InvalidCastException when posting a form containing a field of type 'SimpleTypes/Email'

We are using WFFM with Sitecore 8 and recently have started experiencing an issue whereby any form that contains an email field causes an invalidcastexception when posting the form. If we remove the email field from the form then we can submit successfully. From the exception, it looks like somehow the email field is not being bound correctly, but I can't be certain.
Has anyone experienced anything like this? Details of the exception can be found below.
Unable to cast object of type 'System.String[]' to type 'System.String'.
Description: An unhandled exception occurred.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String[]' to type 'System.String'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.String[]' to type 'System.String'.]
Sitecore.Forms.Mvc.Validators.EmailValidatorAttribute.IsValid(Object value, ValidationContext validationContext) +92
System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(Object value, ValidationContext validationContext) +41
System.Web.Mvc.<Validate>d__15.MoveNext() +264
Sitecore.Forms.Mvc.Controllers.ModelBinders.<Validate>d__1.MoveNext() +940
Sitecore.Forms.Mvc.Controllers.ModelBinders.FieldModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) +392
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
Sitecore.Forms.Mvc.Controllers.ModelBinders.SectionModelBinder.BindFieldCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, IEnumerable`1 list) +570
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +441
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +180
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +68
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
System.Web.Mvc.DefaultModelBinder.UpdateCollection(ControllerContext controllerContext, ModelBindingContext bindingContext, Type elementType) +569
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +976
System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) +33
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +441
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +180
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +68
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +999
Sitecore.Support.Forms.Mvc.Controllers.ModelBinders.FormModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +696
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +437
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +153
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +642
The problem was caused by Glimpse screwing with the model binding. The only solution I have come up with is to disable Glimpse.