When I open the Experience Profile
tab on my Sitecore 9
dashboard, I get an error:
So naturally, I checked the logs and got the following error and stack trace:
> 24872 15:35:09 ERROR [Sitecore Services]: HTTP GET URL > http://demo.site/sitecore/api/ao/v1/contacts/search?&pageSize=20&pageNumber=1&sort=visitCount > desc&match=asdfasdsaf&searchfromdatefilter=01%2F06%2F2017&searchtodatefilter=09%2F11%2F2017&searchchannelfilters={"name":"CHANNEL_FILTERS"%2C"SearchItems":[{"ItemId":"F575D5E6-74DE-49B6-A866-E2256D213D83"}]}&searchcampaignfilters=null&searchoutcomefilters={"name":"OUTCOME_FILTERS"%2C"SearchItems":[{"ItemId":"062A1E69-0BF6-4D6D-AC4F-C11D0F7DC1E1"}]}&searchgoalfilters={"name":"GOAL_FILTERS"%2C"SearchItems":[{"ItemId":"0CB97A9F-CAFB-42A0-8BE1-89AB9AE32BD9"}]}&searchprofilefilters=null&searchdevicefilters=null > > Exception System.NullReferenceException: Object reference not set to an instance of an object. at > Sitecore.Cintel.Endpoint.Plumbing.NegotiateLanguageFilter.OnActionExecuted(HttpActionExecutedContext > actionExecutedContext) at > System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext > actionExecutedContext, CancellationToken cancellationToken) > --- 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 > System.Web.Http.Filters.ActionFilterAttribute.d__5.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 > System.Web.Http.Filters.ActionFilterAttribute.d__0.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 > System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() > --- End of stack trace from previous location where exception was thrown --- at > System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at > System.Web.Http.Filters.ActionFilterAttribute.d__5.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 > System.Web.Http.Filters.ActionFilterAttribute.d__0.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 > System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() > --- End of stack trace from previous location where exception was thrown --- at > System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at > System.Web.Http.Filters.ActionFilterAttribute.d__5.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 > System.Web.Http.Filters.ActionFilterAttribute.d__0.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 > System.Web.Http.Controllers.ActionFilterResult.d__2.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 > System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.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 > System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.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 > System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()
I found this post: https://www.brimit.com/blog/sitecore-9-experience-profile-workaround
But I believe, that is a different problem. Can anyone help me finding out, what is causing the error? I'm at a loss.
EDIT 1:
I decided to extend my post with some more info about my project:
I'm adding Contacts and Interactions to xConnect from a .NET Core application.
I have got a custom xConnect model.
EDIT 2:
Request header was requested so here it is:
GET /sitecore/api/ao/v1/contacts/search?&pageSize=20&pageNumber=%E2%80%8C%E2%80%8B1&sort=visitCount%20%E2%80%8C%E2%80%8Bdesc&match=*&searchf%E2%80%8C%E2%80%8Bromdatefilter=08%2F1%E2%80%8C%E2%80%8B0%2F2017&searchtodat%E2%80%8C%E2%80%8Befilter=09%2F11%2F20%E2%80%8C%E2%80%8B17&searchchannelfilt%E2%80%8C%E2%80%8Bers=null&searchcampa%E2%80%8C%E2%80%8Bignfilters=null&sear%E2%80%8C%E2%80%8Bchoutcomefilters=nul%E2%80%8C%E2%80%8Bl&searchgoalfilters=%E2%80%8C%E2%80%8Bnull&searchprofilefi%E2%80%8C%E2%80%8Blters=null&searchdev%E2%80%8C%E2%80%8Bicefilters=null HTTP/1.1
Host: demo.site
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: scContentEditorFoldersWidth=350; ASP.NET_SessionId=pwjpqa0edoppcgatss1bvmdi; shell#lang=en; __RequestVerificationToken=HnLdm_Now0Drb1P5cSUL4SldKgBBA7IjNyniEEizH-ZtceXy5dvvbheEeHV0bZowutgHlB7m_oLzLC-RTjjCWlkUEX8KrMsda_mhK2igSik1; __CSRFCOOKIE=4476f530-f75a-4ba8-bed4-4909607be60f; sc_fv=0.0.0; login#lang=en; sc_rte_shuser=2E9DAC23EC129E0F1B7D1B113712FEFCE23CBE8A1E770E0CF3198B88833E18BA7C98E4E51FF67BF4E76119BADC0419DADF48CD386DEE7192704505175E22A2D2D7412CAE567BC2973BDB9A01D67759A082039AB688898F348B09F7853A693D97352F49AEC76BED14B076F91D7AB7C530; website#sc_date=; sc_pview_shuser=209481495D3A610022B06B4C4B369240D448EF3D0C84D082172E3AA65E9A1493BFE98AC1EAB9EF217CC86968707DD6C990EE5EFE808491F4DCE4B595D0E5CF1E2F315AF0286F6DB76B339FED839915DD2C44C6A8927590237BB1DDA2331F1AF8D4E319630FE20926682BA578E751D27E; website#sc_mode=preview; website#lang=en; shell#sc_mode=; SC_ANALYTICS_GLOBAL_COOKIE=ea13502c80f84227909a2b77bcce2d77|True; sitecore_userticket=4904DD0629ED4175B5F029EC5EB226C5; .ASPXAUTH=144264DA69EA8BFF543760CDF27F5B92CDE96DEA99AD0CD9C45D05717DBC593965F5EB6B614A7F76A2BCBA6C8F6A5C0AEE8203187C7435289A5F3EABA675254DF053FEC600F32C07C03457A129777B5862A27C64780CD1A3F819CAA104EEF7F75FC5EF4483FC15AE9CA26695E64A29E9
I was fairly hesitant to post my code for creating the Contact and Interaction because I have it very split up throughout my application.
I tried adding the IpInfo
and WebVisit
Facets but without luck so here we go:
Adding a Contact:
public async Task<Contact> AddContact(string email)
{
var cfg = await _xconnect.InitializeXConnect();
using (var client = new XConnectClient(cfg))
{
try
{
var contact = new Contact(
new ContactIdentifier("email", email, ContactIdentifierType.Known)
);
client.AddContact(contact);
await client.SubmitAsync();
return contact;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return null;
}
}
}
Adding an interaction:
public async Task<bool> SendInteraction(Interaction i, StoreInfo storeInfo, ProfileScores profileScore, Contact contact)
{
var cfg = await _xconnect.InitializeXConnect();
using (var client = new XConnectClient(cfg))
{
try
{
client.SetFacet(i, StoreInfo.DefaultFacetKey, storeInfo);
client.SetFacet(i, ProfileScores.DefaultFacetKey, profileScore);
FillRequiredFacets(client, i, contact);
client.AddInteraction(i);
await client.SubmitAsync();
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return false;
}
}
}
private void FillRequiredFacets(XConnectClient client, Interaction interaction, Contact existingContact)
{
//Add Device profile
DeviceProfile newDeviceProfile = new DeviceProfile(Guid.NewGuid());
newDeviceProfile.LastKnownContact = existingContact;
client.AddDeviceProfile(newDeviceProfile);
interaction.DeviceProfile = newDeviceProfile;
//Add fake Ip info
IpInfo fakeIpInfo = new IpInfo("127.0.0.1");
fakeIpInfo.BusinessName = "Home";
client.SetFacet<IpInfo>(interaction, IpInfo.DefaultFacetKey, fakeIpInfo);
//Add fake webvisit
WebVisit fakeWebVisit = new WebVisit();
fakeWebVisit.SiteName = "Offline";
client.SetFacet<WebVisit>(interaction, WebVisit.DefaultFacetKey, fakeWebVisit);
}