EXM adventures
This week I ran into a strange error when integrating Sitecore EXM in our project. EXM module installed just fine and our site kept working. However, EXM did not. When ever I browsed to the EXM dashboard I would receive disturbing errors.
So first step was to dig into the Sitecore logs and I found the following error:
This turned out to be a small database column in the EXM (master and web) database table 'Sessions' with the name ' Ownername'. This was a varchar(50) field, however EXM tries to store here a combination of your machine name and your site name (hostname). for me this combination turned out to be longer then 50 character, so I had to script this column to be larger.
Unfortunately this wasn't the actual issue on my dashboard.
The dashboard wasn't loading correctly due to a failing HTTP POST to "sitecore/api/ssc/EXM/CreateMessageOptions". So I dug into reflector to find this controller and try and determine stuff going on there that could trigger stuff to fault. I checked:
So first step was to dig into the Sitecore logs and I found the following error:
784 08:51:06 ERROR Information about distributed session {1D855C98-4C5E-4675-A15A-1F68D219584B} could not be published to the environment. Agents will be requested to deactivate temporarily. Exception: Sitecore.ExM.Framework.Exceptions.ConnectivityException Message: Failed to store information about the session through the session data provider. Source: Sitecore.ExM.Framework at Sitecore.ExM.Framework.Distributed.Sessions.Session.PublishSessionInfo(Nullable`1 recentMaintenanceTime) at Sitecore.ExM.Framework.Distributed.Sessions.Session.OnSessionUpdateEvent() Nested Exception Exception: System.Data.SqlClient.SqlException Message: String or binary data would be truncated. The statement has been terminated. Source: .Net SqlClient Data Provider at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
Unfortunately this wasn't the actual issue on my dashboard.
The dashboard wasn't loading correctly due to a failing HTTP POST to "sitecore/api/ssc/EXM/CreateMessageOptions". So I dug into reflector to find this controller and try and determine stuff going on there that could trigger stuff to fault. I checked:
- EXM user and advanced user roles creation
- Item existance in core and master database
- Correct passing of guid's to this api
Everything seemed in order. So I had to strip down all my custom code and configs to find the issue.
It turned out that it had to do with a custom JsonMediaTypeFormatter we added to our WebApi config. Once I disabled this formatter for Sitecore api controllers, suddenly the EXM api calls were successful and my dashboard loaded successful.
So my point of advice is: if you need your api's to return custom Json formattng, remember to exclude Sitecore api routes from this formatting!
Reacties
Een reactie posten