umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.41k stars 2.66k forks source link

Error when editing document types with nested BlockList editor: No content with that id. (Parameter 'parentId') #15588

Open creativesuspects opened 8 months ago

creativesuspects commented 8 months ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.1.0-rc

Bug summary

When editing a document type containing one or more nested BlockList editors the POST request to /umbraco/backoffice/umbracoapi/content/GetEmptyByKeys returns the following error:

An error occurred No content with that id. (Parameter 'parentId')

Exception Details System.ArgumentException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: No content with that id. (Parameter 'parentId')

Stacktrace

at Umbraco.Cms.Core.Services.ContentService.Create(String name, Int32 parentId, IContentType contentType, Int32 userId)
   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmpties(IEnumerable`1 contentTypes, Int32 parentId)
   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmptyByKeysInternal(Guid[] contentTypeKeys, Int32 parentId)
   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmptyByKeys(ContentTypesByKeys contentTypeByKeys)
   at lambda_method2298(Closure, Object, Object[])
   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()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

I can still edit and save the document type containing the nested BlockList editor, but the error pops up every time you open the edit view for that document type.

Specifics

Request payload for POST request to /umbraco/backoffice/umbracoapi/content/GetEmptyByKeys:

{"contentTypeKeys":["0016b8e7-8764-494b-8990-78ee346bfb6c"],"parentId":1055}

Response:

{
    "ExceptionMessage": "No content with that id. (Parameter 'parentId')",
    "ExceptionType": "System.ArgumentException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "StackTrace": "   at Umbraco.Cms.Core.Services.ContentService.Create(String name, Int32 parentId, IContentType contentType, Int32 userId)\r\n   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmpties(IEnumerable`1 contentTypes, Int32 parentId)\r\n   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmptyByKeysInternal(Guid[] contentTypeKeys, Int32 parentId)\r\n   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetEmptyByKeys(ContentTypesByKeys contentTypeByKeys)\r\n   at lambda_method2298(Closure, Object, Object[])\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
}

Steps to reproduce

This issue occurs on a clean install of Umbraco 13.1.0-rc, without any custom code.

  1. Create a "parent" element type, e.g. BlockListParent.
  2. Create a "child" element type, e.g. BlockListChild.
  3. Create a BlockList data type containing BlockListParent items.
  4. Create a BlockList data type containing BlockListChild items.
  5. Add the data type for BlockListChild items to the BlockListParent element type.

I've created a screencast to demonstrate the issue:

https://github.com/umbraco/Umbraco-CMS/assets/161342/1ab58a2d-e5ee-401f-9c46-fe40d63df717

Expected result / actual result

No response


This item has been added to our backlog AB#36921

github-actions[bot] commented 8 months ago

Hi there @creativesuspects!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

andr317c commented 8 months ago

Hey! Thanks for reporting this issue! I reproduced this on version 13.1.0-rc, there was no issue on version 13.0.0. This seems like a regression issue. I will go ahead and mark this issue as a sprint candidate 😄

iOvergaard commented 8 months ago

Thanks for reporting this. I have proposed a fix which will end up in the final release of 13.1 with #15615.

creativesuspects commented 8 months ago

@iOvergaard Awesome! Much appreciated.

jo-yeu commented 1 month ago

I'm also seeing this error on 13.4.1