Failed to persist profile to underlying stores – Sitecore Commerce Server

Hello, fellow Sitecorians!
What a wonderful day, it’s spring in the air(at least here in southern Sweden) ๐Ÿ™‚

This is a short post about Sitecore Commerce 8.2.1 and an incredibly annoying bug. Suddenly the registration function stopped working.
I checked the logs and noticed this:

Exception: CommerceServer.Core.Runtime.Profiles.CommerceProfileSystemException
Message: Failed to persist profile to underlying stores.
Source: CommerceServer.Core.Runtime
   at CommerceServer.Core.Runtime.Profiles.Profile.Update()
   at Sitecore.Commerce.Connect.CommerceServer.Profiles.CommerceServerProfileProvider.GetUserProfile(String userName)
   at Sitecore.Commerce.Connect.CommerceServer.Profiles.CommerceServerProfileProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
   at Sitecore.Security.SwitchingProfileProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
   at System.Configuration.SettingsBase.SaveCore()
   at System.Configuration.SettingsBase.Save()
   at System.Web.Profile.ProfileBase.SaveWithAssert()
   at System.Web.Profile.ProfileBase.Save()
   at Sitecore.Security.UserProfile.Save()
   at Sitecore.Security.SecurityUtil.SetUserDigestCredentials(User user, String credentials, String credentialsWithoutDomain)
   at Sitecore.Security.SitecoreMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
   at System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
   at System.Web.Security.Membership.CreateUser(String username, String password, String email)
   at Sitecore.Security.Accounts.User.Create(String userName, String password)
   at Sitecore.Commerce.Data.Customers.SitecoreUserRepository.Create(CommerceUser entity, String password)
   at Sitecore.Commerce.Pipelines.Customers.CreateUser.CreateUserInSitecore.CreateUser(CreateUserRequest request, CreateUserResult result)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Commerce.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Commerce.Services.ServiceProvider.RunPipeline[TRequest,TResult](String pipelineName, TRequest request)
   ...
 

Nested Exception

Exception: System.Runtime.InteropServices.COMException
Message: Exception from HRESULT: 0x80040E2F
Source: CommerceServer.Core.Interop
   at CommerceServer.Core.Interop.Profiles.IProfileObject2.Update()
   at CommerceServer.Core.Runtime.Profiles.Profile.Update()

So I googled and stumbled upon this:
Failed to persist profile to underlying stores in sitecore.stackexchange.com – https://sitecore.stackexchange.com/questions/12433/failed-to-persist-profile-to-underlying-stores
Exactly the same error BUT it had nothing to do with “Looks like your profile and/or encryption might not be set up properly“(the suggested answer).

I was going crazy, I could not find the reason!
But… after many hours I finally found the issue.

I looked into the table UserObject and there it was. Somehow, a user managed to register with all fields set to NULL, except for “u_external_id” and “u_user_id”.

That puppy managed to stop the registration function for the entire website!
After removing the “faulty” user, the registration began to work again.

Thatโ€™s all for now folks ๐Ÿ™‚

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.