umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
29 stars 0 forks source link

Invalid column name 'NodeId' after an upgrade (restart fixes) #1176

Closed Myster closed 4 months ago

Myster commented 4 months ago

Bug summary

This issue only occurred immediately after upgrading Umbraco 10 to 13, and forms from 10.4.0 to 13.0.2 Then click a form in the back office to view it, a red bar shows at the bottom indicating an exception occurred. Restarting the application resolves this issue.

Reproduction & Summary

An existing site with existing forms on these versions

    <PackageReference Include="Umbraco.Cms" Version="10.8.2" />
    <PackageReference Include="Umbraco.Forms" Version="10.4.0" />

Was upgraded to:

    <PackageReference Include="Umbraco.Cms" Version="13.1.1" />
    <PackageReference Include="Umbraco.Forms" Version="13.0.2" />

After the upgrade when visiting a form in the back office this exception occurs:

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'NodeId'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\projects\dotnet\src\MiniProfiler.Shared\Data\ProfiledDbCommand.cs:line 204
   at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at NPoco.Database.ExecuteReaderHelper(DbCommand cmd)
   at NPoco.Database.ExecuteDataReader(DbCommand cmd, Boolean sync)
   at NPoco.AsyncHelper.RunSync[T](Task`1 task)
   at NPoco.Database.QueryImp[T](T instance, Expression`1 listExpression, Func`2 idFunc, Sql Sql, PocoData pocoData)+MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at NPoco.Database.FirstOrDefault[T](Sql sql)
   at Umbraco.Forms.Core.Persistence.Repositories.Implement.FormRepository.PerformGet(Guid id)
   at Umbraco.Cms.Core.Cache.NoCacheRepositoryCachePolicy`2.Get(TId id, Func`2 performGet, Func`2 performGetAll)
   at Umbraco.Forms.Core.Services.BaseService`3.Get(Guid id)
   at Umbraco.Forms.Web.Editors.FormController.GetWithWorkflowsByGuid(Guid guid, Boolean applyDictionaryTranslations)
   at lambda_method8747(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
ClientConnectionId:9c0d9deb-1312-4e21-8460-500020215d53
Error Number:207,State:1,Class:16
AndyButland commented 4 months ago

Obviously it's tricky to to fully replicate an upgrade scenario, but I tried to follow the path you took and didn't find a problem. Here's what I did:

dotnet new install Umbraco.Templates::10.8.2
dotnet new umbraco --name TestProject
cd .\TestProject\
dotnet add package Umbraco.Forms --version 10.4.0
dotnet run

Then clicked through the installer and used a SQL Server database. Created a form. Stopped site, and upgraded to the versions you have have indicated.

<PackageReference Include="Umbraco.Cms" Version="13.1.1" />
<PackageReference Include="Umbraco.Forms" Version="13.0.2" />

Then:

dotnet build
dotnet run

Got the expected "website under maintenance" screen.

Navigated to /install, logged in, ran upgrade. Could see in the logs that the Forms upgrade ran, and then opening and re-saving the form worked as expected.


I'll close this given there doesn't seem to be a general problem and you've resolved your issue after a restart - but if you have any further to add or can see something different between the upgrade I've followed and yours, please feel free to re-open.