Try our conversational search powered by Generative AI!

Service API - Media is not found error

Vote:
 

Hi, I have registered a support ticket about this but wanted to hear if somebody else has experienced this issue. This is what I sent to support:

Hi,

We periodically get error when sending product update requests to Service API:

An error has occurred.
Media is not found. Navigate to Assets tab and remove it in order to publish.

I have tracked the error down and it seems that in some occasions asset links (stored in CommerceMediaCollection) are left hanging on language versions other than Master Language, which leads to this error when making any change on those language versions. This shouldn't be happening right? Since asset links are stored on Master Language version, it should only be required to remove the links on that version, correct?

I found it out by browsing to the "Assets" tab in Commerce UI and noticed that the asset link had been removed from Master Language, but when switching to any other language, the link was still in the list, but with a "Media not found" message.

I think this happens on products where we have previously deleted an asset with Service API through Media Service XML Obviously the asset link is successfully removed from master language and since CommerceMediaCollection is not CultureSpecific, this must be some cache related issue. The problem auto heals when I go to the Commerce UI and publish any random change on the master language version. I have attached two screenshots which shows Assets tab on master language and another version. As you can see, there is a "MeasurementDrawing" asset at the bottom of the other language version that doesn't exist on master language.

Commerce version: 13.32.2

This is the stack trace for the error:

An error has occurred.
Media is not found. Navigate to Assets tab and remove it in order to publish.
System.ComponentModel.DataAnnotations.ValidationException
   at EPiServer.Core.ContentProvider.ThrowValidationException(ICollection`1 errors)
   at EPiServer.Core.Internal.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access)
   at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Persistence.CatalogModelCommmitterBase.<>c__DisplayClass12_0`2.<UpdateCultureSpecificProperties>g__UpdateProperty|1(CultureInfo language, T contentWithLanguage)
   at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Persistence.CatalogModelCommmitterBase.UpdateCultureSpecificProperties[T,TModel](T catalogContent, TModel catalogNode)
   at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Persistence.EntryModelCommitter.SaveCatalogEntry(Entry catalogEntry)
   at EPiServer.ServiceApi.Commerce.Controllers.Catalog.EntryController.PutCatalogEntry(String entryCode, Entry catalogEntry)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()
#287427
Sep 15, 2022 7:40
Vote:
 

Mattias, I remember having this problem for a client I worked with two years ago. Sending updates to service api for variants ended up having a new version being created but they were not publishing due to some obscure error...had to manually go into the UI and publish it.

Searching my brain, I think we ended up having to create a custom webapi method to sit along side service api and have client call this one instead because we checked the versions then published the correct one. Is this a similiar scenario as the one your describing? 

I don't recall my scenario being related to mediaassets but it would be interesting to see if we could replicate it.

#288367
Sep 30, 2022 0:28
Vote:
 

Hey Mattias,

Just wanted to note that we have the exact same problem :) 

/Mattias

#291465
Nov 11, 2022 13:10
* 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.