Virtual Happy Hour is canceled this month (March) due to Good Friday.
Virtual Happy Hour is canceled this month (March) due to Good Friday.
EPiServer.ServiceApi 2.1.0
EPiServer.Commerce 10.4.0
Feb 02, 2017
Mar 06, 2017
Service API
Closed, Fixed and tested
Client reported this issue with EPIServer.ServiceApi.Commerce 2.1.0.
"I discovered a bug with Commerce ServiceAPI. We are currently unable to update any nodes and it seems to be related to UriSegment. Please see the error below. When I use ServiceAPI to get any node, it always has „UriSegment“: null, but all nodes in database have UriSegments set.
2017-01-05 14:07:09,156 [78] ERROR EPiServer.ServiceApi.Commerce.Controllers.Catalog.NodeController: The value for column 'UriSegment' in table 'CatalogItemSeo' is DBNull.
System.Data.StrongTypingException: The value for column 'UriSegment' in table 'CatalogItemSeo' is DBNull. ---> System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.
at Mediachase.Commerce.Catalog.Dto.CatalogNodeDto.CatalogItemSeoRow.get_UriSegment()
— End of inner exception stack trace —
at Mediachase.Commerce.Catalog.Dto.CatalogNodeDto.CatalogItemSeoRow.get_UriSegment()
at Mediachase.Commerce.Catalog.Data.CatalogNodeAdmin.CreateItemSeoDataTable(IDictionary`2 nodeIdsAndNames, CatalogNodeDto nodeDto)
at Mediachase.Commerce.Catalog.Data.CatalogNodeAdmin.ValidateAndLoadSeo(IDictionary`2 nodeIdsAndNames, CatalogNodeDto nodeDto)
at Mediachase.Commerce.Catalog.Data.CatalogNodeAdmin.<>c_DisplayClass23_0.<EnsureSeoDataIsValidForItems>b_2()
at Mediachase.Commerce.Catalog.Data.CatalogNodeAdmin.EnsureSeoDataIsValidForItems(CatalogNodeDto savedCatalogNodeDto, Boolean hasCustomUniqueValueGenerator)
at Mediachase.Commerce.Catalog.Data.CatalogNodeAdmin.Save()
at Mediachase.Commerce.Catalog.Managers.CatalogNodeManager.SaveCatalogNode(CatalogNodeDto dataset)
at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Persistence.NodeModelCommitter.SaveCatalogNodeDto(Node catalogNode, IPrincipal principal)
at EPiServer.ServiceApi.Commerce.Controllers.Catalog.NodeController.PutCatalogNode(String code, Node catalogNode)
Seems like I have found how/why the issue happens. Besides main languages(et, ru, lv, ru-LV), we also enabled in CMS Finnish, Lithuanian and English (which is mandatory for EPiS and cannot be disabled). However, in Commerce catalog we only enabled et, ru, lv and ru-LV.
At some point in the past, EPiS used to create metadata for all languages despite being disabled. So now every time I make request for node in ServiceAPI, it also returns SEO for all those disabled languages and with UriSegment NULL. Note that the UriSegment is NOT NULL in database as you can see from my screenshots from first email. Also, it does not return disabled languages for MetaFields. When I modify node (for example Name and Description) and POST it back with ServiceAPI, it gives the error.