Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alexander Wagner 32 posts 162 karma points
    Jun 13, 2023 @ 13:53
    Alexander Wagner
    0

    Upgrade Umbraco Forms 7 to 8. Migration crashes when setting StoreUmbracoFormsInDb to true

    We've just upgraded our clients Umbraco 7-site to Umbraco 8 (Umbraco 8.18.7. Umbraco Forms 8.13.7) and everything went quite well.

    They have around 30 different forms on their site and now they're saved as json-files on disk (StoreUmbracoFormsInDb is set to false).

    We're planning on continuing upgrading their site to latest Umbraco this fall but one thing that's blocking us is that the migration to storing Umbraco forms in database crashes when we set StoreUmbracoFormsInDb to true.

    Since they have so many different forms it would be a hassle to re-create them if we just enable StoreUmbracoFormsInDb without any json-files on disk.

    Has anyone else stumbled upon this and solved this issue? Here's the stack trace:

    Boot failed: Umbraco cannot run. See Umbraco's log file for more details.
    
    -> Umbraco.Core.Exceptions.BootFailedException: Boot failed.
    
    -> System.NullReferenceException: Object reference not set to an instance of an object.
      at Umbraco.Forms.Core.Models.Field.ParsePrevalueStoredWithSeparator(String prevalue)
      at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
      at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
      at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
      at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
      at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, JsonSerializerSettings settings)
      at Umbraco.Forms.Core.Persistence.Factories.FormFactory.BuildDto(IFormEntity entity)
      at Umbraco.Forms.Core.Persistence.Repositories.Implement.FormRepository.PersistNewItem(IFormEntity entity)
      at Umbraco.Core.Cache.DefaultRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew) in D:\a\1\s\src\Umbraco.Core\Cache\DefaultRepositoryCachePolicy.cs:line 104
      at Umbraco.Forms.Core.Services.BaseService`4.Save(TEntity entity, TType item, Dictionary`2 additionalData)
      at Umbraco.Forms.Core.Services.BaseService`4.Insert(TType item, Dictionary`2 additionalData)
      at Umbraco.Forms.Core.Services.BaseService`4.Insert(TType item)
      at Umbraco.Forms.Core.Migrations.V_8_5_0.FormFilesAndWorkflowFilesToDb.Migrate()
      at Umbraco.Forms.Core.Migrations.V_8_5_0.AddFormsDbStorage.Migrate()
      at Umbraco.Core.Migrations.MigrationBase.Umbraco.Core.Migrations.IMigration.Migrate() in D:\a\1\s\src\Umbraco.Core\Migrations\MigrationBase.cs:line 73
      at Umbraco.Core.Migrations.MigrationPlan.Execute(IScope scope, String fromState, IMigrationBuilder migrationBuilder, ILogger logger) in D:\a\1\s\src\Umbraco.Core\Migrations\MigrationPlan.cs:line 316
      at Umbraco.Core.Migrations.Upgrade.Upgrader.Execute(IScopeProvider scopeProvider, IMigrationBuilder migrationBuilder, IKeyValueService keyValueService, ILogger logger) in D:\a\1\s\src\Umbraco.Core\Migrations\Upgrade\Upgrader.cs:line 67
      at Umbraco.Forms.Core.Components.UmbracoFormsComponent.ExecuteDatabaseUpgrades()
      at Umbraco.Forms.Core.Components.UmbracoFormsComponent.Initialize()
      at Umbraco.Core.Composing.ComponentCollection.Initialize() in D:\a\1\s\src\Umbraco.Core\Composing\ComponentCollection.cs:line 32
      at Umbraco.Core.Runtime.CoreRuntime.Boot(IRegister register, DisposableTimer timer) in D:\a\1\s\src\Umbraco.Core\Runtime\CoreRuntime.cs:line 219
    
  • Eduardo Encina 1 post 91 karma points
    Sep 07, 2023 @ 02:11
    Eduardo Encina
    100

    Hi Alexander hope is not too late but I had the same issue.

    As the error says, we need to check the "preValues" property from the forms files, sometimes it can be null or contain an array of strings with a null in it like

    { "preValues": ["string", "string", null]} or {"prevalues": null}
    

    Remove those nulls and the migration should work.

    cheers!

  • Alexander Wagner 32 posts 162 karma points
    Sep 07, 2023 @ 10:46
    Alexander Wagner
    0

    Hi Eduardo. What a life saver! I went through all old form json-files and found some fors that hade null values and after correcting them the import worked like a charm.

Please Sign in or register to post replies

Write your reply to:

Draft