Try our conversational search powered by Generative AI!

Commerce 12.2.0 Upgrade Issue - Commerce Manager view carts

Vote:
 

Hi!

We've upgraded to EPiServer commerce 12.2.0, now when we're trying to browse the carts we receive this error.

[ArgumentNullException: Value cannot be null.
Parameter name: marketId.Value]
   Mediachase.Commerce.Markets.Database.MarketServiceCache.GetMarket(MarketId marketId) +176
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.CalculateShippingSubTotal(IOrderGroup orderGroup) +145
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.GetShippingSubTotal(IOrderGroup orderGroup) +56
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.CalculateTotal(IOrderGroup orderGroup) +205
   EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.GetTotal(IOrderGroup orderGroup) +78
   Mediachase.Web.Console.Controls.EcfListView.AddCurrencyToCell(Object dataItem, CultureInfo culture, ViewColumn column, HtmlTableCell dataCell) +311
   Mediachase.Web.Console.Controls.EcfListView.BindDataRows(AdminView adminView, HtmlTableRow tableRow, Object dataItem, Int32 currentIndex) +591
   Mediachase.Web.Console.Controls.EcfListView.OnItemCreated(ListViewItemEventArgs e) +226
   System.Web.UI.WebControls.ListView.CreateItemsWithoutGroups(ListViewPagedDataSource dataSource, Boolean dataBinding, InsertItemPosition insertPosition, ArrayList keyArray) +1019
   System.Web.UI.WebControls.ListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +1250
   System.Web.UI.WebControls.ListView.PerformDataBinding(IEnumerable data) +53
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +207
   System.Web.UI.WebControls.ListView.PerformSelect() +125
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +134
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +35

Any thoughts?

Best,
Emil

#192684
May 22, 2018 16:42
Vote:
 

Hi Emil,

What's your previous Commerce version?

/Viet Anh

#192689
May 23, 2018 4:41
Vote:
 

Hi Viet Anh,

We went from version 11.8.3.

/Emil

#192691
May 23, 2018 8:05
Vote:
 

It seems to me that your database was not properly migrated. When you upgrade to Commerce 12, IOrderGroup.Market was obsoleted, and we now store other properties of the market instead. The upgrade script would have taken care of those changes, but it's possible that it was not run properly, or one ore more of your carts were in a deleted market (so it can't match the data).

You didn't mention which cart system you are using, but assuming you are using SerializableCart, I'd suggest to look into that SerializableCart table to see if MarketId column is null for anything. If not, check OrderGroup table for null MarketId row.

#192693
May 23, 2018 9:32
Vote:
 

Hi Quan,

You are correct, we're using the SerializableCart and we found a small subset of carts that indeed do not contain the new marketId property.

Thinking of a potential solution for this. Do this table hold references to other tables? Or should it be safe to remove these carts from the SerializableCart table?

/Emil

#192713
May 23, 2018 16:28
Vote:
 

Now I looked more closely into it, SerializableCart has had MarketId since the beginning, and it's not allowed to be null... Same for OrderGroup.

So I was (partly) wrong. Did you delete the Default market somehow?

#192714
May 23, 2018 16:48
Vote:
 

I can't remember we have removed the default market. It is deactivated however. 

The number of carts that do not have the marketId is a total of 14 out of 21000.

The created timestamp of those 14 actually range very closely to the upgrade date.

/Emil

#192715
May 23, 2018 17:06
Vote:
 

Before, or after? :). If it's after, are there other (OK) carts created after the upgrade?

Well, deleting them is one option, but I really want to get to the bottom of this.

If you are in a hurry, then it's probably safer to set the marketid for those carts to DEFAULT, to make CM works instead of just deleting them.

#192716
May 23, 2018 17:25
Vote:
 

It was deactivated before the migration. There are new carts that are created after the upgrade and I can list them in the CM without breaking. However when trying to inspect a specific cart we get this error

[InvalidCastException: Unable to cast object of type 'EPiServer.Commerce.Order.Internal.SerializableOrderForm' to type 'Mediachase.Commerce.Orders.OrderForm'.]
   Mediachase.Commerce.Manager.Apps_Code.Order.OrderHelper.GetDiscountNamesList(IOrderForm orderForm, ILineItem lineItem) +648
   Mediachase.Commerce.Manager.Apps.Order.Modules.<GetOrderLineItems>d__36.MoveNext() +1601
   Mediachase.Commerce.Manager.Apps.Order.Modules.RelatedEntityView.LoadDataAndDataBind() +472
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +190
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.MakeDataBindColl(ControlCollection coll, Object obj) +245
   Mediachase.BusinessFoundation.XmlFormBuilder.OnInnerDataBind(Object sender, EventArgs e) +44
   Mediachase.BusinessFoundation.XmlFormBuilder.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +75
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +168
   Mediachase.Commerce.Manager.Apps.Order.Modules.OrderView.Page_Load(Object sender, EventArgs e) +1180
   System.Web.UI.Control.OnLoad(EventArgs e) +96
   System.Web.UI.Control.LoadRecursive() +154
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Control.LoadRecursive() +251
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2168

Here is an example on a new serialized cart after the upgrade

{
  "id": 24970,
  "created": "2018-05-24T06:49:38.093Z",
  "currency": "EUR",
  "customerId": "<hide>",
  "forms": [
    {
      "orderFormId": -1,
      "authorizedPaymentTotal": 0.0,
      "capturedPaymentTotal": 0.0,
      "handlingTotal": 0.0,
      "name": "Default",
      "shipments": [
        {
          "shipmentId": -1,
          "shippingMethodId": "<hide>",
          "shippingMethodName": null,
          "shippingAddress": {
            "id": "Shipping Address: ()",
            "firstName": null,
            "lastName": null,
            "organization": null,
            "line1": null,
            "line2": null,
            "city": null,
            "countryCode": "SWE",
            "countryName": null,
            "postalCode": null,
            "regionCode": null,
            "regionName": null,
            "daytimePhoneNumber": null,
            "eveningPhoneNumber": null,
            "faxNumber": null,
            "email": null,
            "properties": {
              "locale": {
                "$type":
                  "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
                "$value": "en"
              },
              "vatId": null
            }
          },
          "shipmentTrackingNumber": null,
          "orderShipmentStatus": 1,
          "pickListId": null,
          "warehouseCode": "default",
          "lineItems": [
            {
              "lineItemId": -1,
              "code": "<hide>",
              "displayName": null,
              "placedPrice": 11.2,
              "quantity": 3.0,
              "returnQuantity": 0.0,
              "inventoryTrackingStatus": 0,
              "isInventoryAllocated": false,
              "isGift": false,
              "properties": {},
              "allowBackordersAndPreorders": false,
              "inStockQuantity": 0.0,
              "backorderQuantity": 0.0,
              "preorderQuantity": 0.0,
              "inventoryStatus": 0,
              "maxQuantity": 0.0,
              "minQuantity": 0.0,
              "entryAmount": 0.0,
              "orderAmount": 0.0,
              "taxCategoryId": 1,
              "salesTax": 0.0,
              "isSalesTaxUpToDate": true
            }
          ],
          "properties": {
            "locale": {
              "$type":
                "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
              "$value": "en"
            },
            "vatId": null
          },
          "shipmentDiscount": 0.0,
          "isShippingCostUpToDate": true,
          "isShippingTaxUpToDate": true,
          "shippingCost": 3.2,
          "shippingTax": 0.0,
          "operationKeys": {}
        }
      ],
      "promotions": [],
      "couponCodes": [],
      "payments": [],
      "properties": {
        "locale": {
          "$type":
            "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
          "$value": "en"
        },
        "vatId": null
      }
    }
  ],
  "market": null,
  "marketId": "ROW",
  "marketName": "ROW",
  "pricesIncludeTax": false,
  "modified": "2018-05-24T06:49:45.5617948Z",
  "name": "Default",
  "notes": [],
  "orderLink": {
    "orderGroupId": 24970,
    "name": "Default",
    "customerId": "<hide>",
    "orderType":
      "EPiServer.Commerce.Order.Internal.SerializableCart, EPiServer.Business.Commerce, Version=12.2.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"
  },
  "orderStatus": 4,
  "organization": null,
  "properties": {
    "locale": {
      "$type":
        "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
      "$value": "en"
    },
    "vatId": null
  },
  "isTaxTotalUpToDate": true,
  "taxTotal": 0.0
}

Here is one of the carts that failed

{
  "id": 24334,
  "created": "2018-05-22T09:07:14.383Z",
  "currency": "EUR",
  "customerId": "<hide>",
  "forms": [
    {
      "orderFormId": -1,
      "authorizedPaymentTotal": 0.0,
      "capturedPaymentTotal": 0.0,
      "handlingTotal": 0.0,
      "name": "Default",
      "shipments": [
        {
          "shipmentId": -1,
          "shippingMethodId": "00000000-0000-0000-0000-000000000000",
          "shippingMethodName": null,
          "shippingAddress": {
            "id": "Shipping Address: ()",
            "firstName": null,
            "lastName": null,
            "organization": null,
            "line1": null,
            "line2": null,
            "city": null,
            "countryCode": "SWE",
            "countryName": null,
            "postalCode": null,
            "regionCode": null,
            "regionName": null,
            "daytimePhoneNumber": null,
            "eveningPhoneNumber": null,
            "faxNumber": null,
            "email": null,
            "properties": {}
          },
          "shipmentTrackingNumber": null,
          "orderShipmentStatus": 1,
          "pickListId": null,
          "warehouseCode": null,
          "lineItems": [],
          "properties": {},
          "shipmentDiscount": 0.0,
          "operationKeys": {}
        }
      ],
      "promotions": [],
      "couponCodes": [],
      "payments": [],
      "properties": {}
    }
  ],
  "market": "ROW",
  "modified": "2018-05-22T09:07:14.7129498Z",
  "name": "Default",
  "notes": [],
  "orderLink": {
    "orderGroupId": 24334,
    "name": "Default",
    "customerId": "<hide>",
    "orderType":
      "EPiServer.Commerce.Order.Internal.SerializableCart, EPiServer.Business.Commerce, Version=11.8.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"
  },
  "orderStatus": 4,
  "organization": null,
  "properties": {}
}
#193156
May 24, 2018 9:13
Vote:
 

Regarding 

[InvalidCastException: Unable to cast object of type 'EPiServer.Commerce.Order.Internal.SerializableOrderForm' to type 'Mediachase.Commerce.Orders.OrderForm'.]

IIRC then this was because WorkflowsVNext was not enabled in ecf.app.config 

Back to the MarketId thing-y, I had time to dig into it and TBO it makes my head spinning a bit. The marketid inside the SerializableCart is different from the MarketId column in SerializableCart table. My initial thought is this is a bug. I will dig a little more and keep you updated. 

#193168
May 24, 2018 10:10
Vote:
 

It's a bug - and we will try to fix it ASAP.

#193171
May 24, 2018 10:54
Vote:
 

Thank you for helping investigate this.

Do you know how the approach for this will be? Will you create a new migration step that will correct my issue as well - or should I proceede with a SQL script fix?

/Emil

#193172
May 24, 2018 10:58
Vote:
 
<p>Is this in preproduction or in production already? If you can, I'd suggest to turn on DEFAULT market, and try to migrate again.&nbsp;</p> <p>If you already deployed to production, then things get tricky and I would have to suggest you to contact developer support service. We might have to do some direct database manipulation and I just can't tell it here. Also we need to look into the data and do some testing before sending the workaround for you.&nbsp;</p>
#193173
May 24, 2018 11:07
Vote:
 

Hi Emil,

We have already a migration step to migrate existing serializable carts when upgrading to Commerce 12.0.0. It's name is: "Migrates existing serializable carts." and it'll update the MarketId for the existing serializable carts. It seems to me that there were something wrong with this step.

Did it executed successfully? Or were there any error in the progress message when doing the migration? It'll help us to identify the problem quicker.

Thanks!

#193216
May 25, 2018 10:33
Vote:
 

Hi Bien, 

We have the "auto migrate setting" on, if I go to the episerver/commerce/migrate it's checked as done in the list.

The application is hosted on your DXC service. I pulled the logs from the time of the upgrade and there is two different errors 

EPiServer.Framework.Initialization.InitializationEngine : Initialize action failed for 'Initialize on class EPiServer.Initialization.Internal.ModelSyncInitialization, EPiServer, Version=11.7.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'

And many of this

EPiServer.DataAccess.Internal.JsonPropertyValueConverter : An exception occurred while converting JSON property

@Quan this is done on our production environment

/Emil

#193217
May 25, 2018 10:59
Vote:
 

Thanks for your information. There were problems when upgrading obviously and that made the migration step stop working. So existing serializable carts were not migrated (correctly) logically.

However with the given logs, it's hard to know exactly where is the root cause. In this case, as Quan said, we would suggest you to contact our developer support service, so we can dig into it deeper.

/Bien

#193229
May 25, 2018 12:33
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.