Order / Macro Errors

Brandon Prudent asked on June 15, 2018 05:35

In our staging environment we are unable to place orders successfully. We did some digging and saw that our app salt was different between environments and some objects had been migrated over. We were getting some macro security errors in the log and resigning the macros seem to have resolved those particular errors.

However, the errors continue on staging only. Local environments seem to run without trouble. There are six error messages in the event log, all back to back. They all look like this:

Error while evaluating expression: HTMLEncode(Order.OrderInvoiceNumber) |(identity)GlobalAdministrator|(hash)99a9e46a2f89f5a1f976c72c5a30758452d38321889b0f5e5e0b27b094545d24

CMS.MacroEngine.EvaluationException: Exception occured while evaluation of the expression 'HTMLEncode(Order.OrderInvoiceNumber) |(identity)GlobalAdministrator|(hash)99a9e46a2f89f5a1f976c72c5a30758452d38321889b0f5e5e0b27b094545d24': Method 'HTMLEncode' for object of type 'System.String' not found, please check the macro or the method declaration. at CMS.MacroEngine.ExpressionEvaluator.ThrowMethodNotFound(Object callingObject) at CMS.MacroEngine.ExpressionEvaluator.EvaluateMethodCall(Boolean& match, Boolean& securityPassed) at CMS.MacroEngine.ExpressionEvaluator.EvaluateInternal(Boolean& match, Boolean& securityPassed) at CMS.MacroEngine.ExpressionEvaluator.Evaluate() at CMS.MacroEngine.MacroResolver.ResolveMacroExpression(ResolveExpressionSettings settings)

The error displayed on screen and coming out of the cart looks like this:

[SqlException (0x80131904): The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_COM_Order_OrderStatusID_COM_Status". The conflict occurred in database "CMS", table "dbo.COM_OrderStatus", column 'StatusID'. The statement has been terminated.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +3188568 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +332 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +5042 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +87 System.Data.SqlClient.SqlDataReader.get_MetaData() +101 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +590 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3136 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +691 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +123 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +301 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +202 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +178 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +122 CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +254

UPDATE COM_Order SET [OrderStatusID] = @OrderStatusID, [OrderInvoice] = @OrderInvoice, [OrderInvoiceNumber] = @OrderInvoiceNumber, [OrderLastModified] = @OrderLastModified WHERE [OrderID] = @OrderID

Caused exception: The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_COM_Order_OrderStatusID_COM_Status". The conflict occurred in database "CMS", table "dbo.COM_OrderStatus", column 'StatusID'. The statement has been terminated. ] CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, Exception ex) +282 CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +612 CMS.DataEngine.GeneralConnection.RunQuery(QueryParameters query) +322 CMS.DataEngine.GeneralConnection.RunQueryWithRetry(QueryParameters query, Int32 retryCount) +191 CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords) +67 CMS.DataEngine.DataQueryBase1.GetDataFromDBInternal() +133 CMS.DataEngine.DataQueryBase1.GetDataFromDB() +61 CMS.DataEngine.DataQueryBase1.GetData() +125 CMS.DataEngine.SimpleDataClass.Update() +396 CMS.DataEngine.AbstractInfoBase1.UpdateData() +378 CMS.DataEngine.AbstractInfoProvider3.SetInfo(TInfo info) +761 CMS.Ecommerce.OrderInfoProvider.SetOrderInfoInternal(OrderInfo orderObj) +807 CMS.Ecommerce.ShoppingCartInfoProvider.SetOrderInternal(ShoppingCartInfo cart, Boolean generateInvoice) +2754 Kentico.Ecommerce.ShoppingService.CreateOrder(ShoppingCart cart) +69 Sologic.Website.Lib.Services.Orders.KenticoHandler.Process() in C:\TeamCity\buildAgent\work\25f3e607f5bd130d\Website.Lib\Services\Orders\KenticoHandler.cs:30 Sologic.Website.Lib.Services.Orders.<Complete>d__50.MoveNext() in C:\TeamCity\buildAgent\work\25f3e607f5bd130d\Website.Lib\Services\Orders\Order.cs:265 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() +31 Sologic.Website.Controllers.

Recent Answers


Peter Mogilnitski answered on June 15, 2018 17:05

0 votesVote for this answer Mark as a Correct answer

Brandon Prudent answered on June 15, 2018 17:12

Hey there - thanks for the suggestion - that's been completed already as I mentioned. It did change the error messaging to these RESOLVEDATAMACRO issues.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.