SaaS CMS has officially launched! Learn more now.

Removing Default Warehouse prevents web app from starting


We get the warehouses from integration, so I thought I'd remove the Default Warehouse since we do not use it. Didn't think about it, I just did it. Little did I know that the web app would not be able to start anymore without it.

Initialize action failed for 'Initialize on class EPiServer.Commerce.Initialization.CartModeInitializationModule, EPiServer.Business.Commerce, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'
System.Exception: Exception in [ecf_ShippingMethod_Language]: ForeignKeyConstraint ShippingMethod_MarketShippingMethods requires the child key values (dade7f46-646b-4a16-9226-4e574c8c79e6) to exist in the parent table.
       ---> System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
         at System.Data.DataSet.FailedEnableConstraints()
         at System.Data.DataSet.EnableConstraints()
         at System.Data.DataSet.set_EnforceConstraints(Boolean value)
         at System.Data.DataTable.EndLoadData()
         at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
         at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
         at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
         at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
         at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
         at Mediachase.Data.Provider.SqlDataProvider.<>c__DisplayClass21_0.b__0()
         at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
         at Mediachase.Data.Provider.SqlDataProvider.WithRetry[TResult](Func`1 action
         at Mediachase.Data.Provider.SqlDataProvider.LoadDataSet(DataCommand command)

To me, this is definitely a bug. Don't allow the user to do this if it has such catastrofic effects.

Edited, Oct 05, 2023 8:59

Just to be clear, did you delete the warehouse, or did you delete the market? because the error appears to be related to the market, not warehouse 

Oct 05, 2023 11:50
Kristoffer Persson - Oct 05, 2023 12:03
I definitely only deleted the default warehouse from the admin UI.

When this happened, I restored an older database locally, started the web app and everything worked fine. Then the ONLY thing I did was deleting the Default Warehouse. After that, restarted the app and now it crashed during startup.

Then it is definitely a bug. I will try to reproduce it and file a bug to Commerce team. Thanks for bringing it into our attention 

Oct 05, 2023 12:23

Unfortunately I can't reproduce it. the demo site we use for develop does not have Default warehouse by default. Maybe something is with your site, please contact developer service for further assistance

(not saying it's not a bug, it is probably still is, but we can't really fix it without understand what's wrong)

Edited, Oct 05, 2023 13:28

The stacktrace point to Shipping method: 'dade7f46-646b-4a16-9226-4e574c8c79e6'. This is a "In store Pickup" shipping metodh, that I think is a commerce default shipping method... 

We got the same error in
CartModeInitializationModule when we change the setting "Is pickup location" for Default warehouse to 'No'. The site would not start the next time the site was restarted. Definitly a bug. 

Oct 26, 2023 8:54

Just FYI this was created as a support case for the commerce development team and we are looking into it. 

Oct 27, 2023 6:12
* 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.