November Happy Hour will be moved to Thursday December 5th.

Failure during upgrade Commerce 12.3 -> 12.4

Vote:
 

Today I upgraded my solution from EPiServer Commerce 12.3 to 12.4. During execution of the "migrate target markets" migration step, I got the following error message:

Update promotion priority failed with exception 'System.ComponentModel.DataAnnotations.ValidationException: The valid from date cannot be empty. at EPiServer.Core.ContentProvider.ThrowValidationException(ICollection`1 errors) at EPiServer.Core.ContentProvider.Validate(IContent content, ContentSaveValidationContext saveValidationContext) at EPiServer.Core.Internal.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access) at EPiServer.Commerce.Internal.Migration.Steps.MigrateTargetMarketsStep.MigrateTargetMarket(SalesCampaign campaign) at EPiServer.Commerce.Internal.Migration.Steps.MigrateTargetMarketsStep.Execute(IProgressMessenger progressMessenger)'. 

As far as my understanding goes, there is supposedly a data issue with one of the sales campaigns. However, manually checking in the tblContentProperty tables did not give me any odd results for any sales campaigns currently in the system. Re-running and restarting the web application did not resolve the issue either. I've temporarily disabled the migration step by setting it as completed in tblBigTable.

Luckily this was not on a production environment :-)

Is this a known issue?

#195040
Jul 11, 2018 18:16
Vote:
 

No this is not a known issue. It is very strange - I would suggest you to contact our developer support so we can look into this. Thanks

#195041
Jul 11, 2018 19:03
Vote:
 

One workaround is to create an instance of IMigrateStep, with SortOrder = 1549. Well technically IMigrateStep is an internal interface, but because you even accessed database directly, so that should be no problem for you. Inside Execute method you can try to load campaigns and foreach each of them. With a debugger you can find out which campaign is problematic and even fix it.

We recommend against skipping migration steps

#195047
Jul 12, 2018 8:20
Vote:
 

Thanks for your insights, Quan Mai! After a good night's sleep we've had a fresh look at this.

We built a custom MigrationStep as per your suggestion, and used it to investigate which SalesCampaign had an invalid ValidFrom date. As it turned out, there was indeed one - it was set to 01/01/0001 00:00, i.e. a DateTime's MinValue. We didn't see this yesterday when looking in the database (probably due to a bad JOIN :-) ).

Upon further investigation we've been able to identify the root cause. It can be reproduced as follows:

  1. Go into the EPiServer backend, go to Commerce and then Marketing
  2. Create a new Campaign and give it a name
  3. When the edit page opens, just close the browser window.
  4. Check tblContent: a new row has been created for the campaign, but without ValidFrom and ValidUntil properties in tblContentProperty.

When the MigrationStep is subsequently executed, the validator which runs during saving refuses to save the entity as it does not have a valid ValidFrom date.

P.S. we re-enabled the migration step, and it has now executed successfully after removing the rogue sales campaign.

#195068
Edited, Jul 12, 2018 13:58
Vote:
 

Good work on the trouble shooting!

I think I'll go ahead and register a bug for this. We should look into if we can make the migration step should be a bit more graceful in handling "unexpected" data.

Regards

Per Gunsarfs

#195073
Jul 12, 2018 14:59
Vote:
 

I see that this issue has been fixed in Commerce 12.4.1. Thanks for the quick turnaround :)

#195586
Jul 31, 2018 9:42
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.