New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'ObjectContent`1' type failed to serialize the response body #2144

Open
kgiszewski opened this Issue Mar 23, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@kgiszewski

kgiszewski commented Mar 23, 2018

Getting this error in two spots.

In the Merchello Product section and when attempting to select a product via the picker.

M v2.6.0
U 7.7.13

{"message":"An error has occurred.","exceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","exceptionType":"System.InvalidOperationException","stackTrace":null,"innerException":{"message":"An error has occurred.","exceptionMessage":"A parameter passed into a method was not a valid value\r\nParameter name: contentTypeKey","exceptionType":"System.ArgumentException","stackTrace":"   at Umbraco.Core.Mandate.That[TException](Boolean condition, Func`1 defer)\r\n   at Merchello.Core.ValueConverters.DetachedValuesConverter.GetContentTypeByKey(Guid contentTypeKey)\r\n   at Merchello.Web.Models.ContentEditing.Content.DetachedContentDisplayExtensions.EnsureValueConversion(ProductDisplayBase display, DetachedValuesConversionType conversionType)\r\n   at Merchello.Web.Models.ContentEditing.Content.DetachedContentDisplayExtensions.EnsureValueConversion(ProductDisplay display, DetachedValuesConversionType conversionType)\r\n   at Merchello.Web.Editors.ProductApiController.MapToProductDisplay(IProduct product)\r\n   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n   at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"}}

These errors don't make it to the log, only way to find them is to inspect JS responses.

image

image

Attempts to rebuild Examine have also error'ed out.

Deleting all Merchello Examine indexes didn't resolve either.

@kgiszewski

This comment has been minimized.

kgiszewski commented Mar 23, 2018

Additional info.

I installed FastTrack and began to remove T-Shirts. Also had an issue that might be related where deleting fails on the collection #2143.

@kgiszewski

This comment has been minimized.

kgiszewski commented Mar 23, 2018

Looks like the UmbracoContent Type Key is empty and it can't be (mandated later on):

image

@kgiszewski

This comment has been minimized.

kgiszewski commented Mar 23, 2018

Ok, I pieced together the chain of events that caused this.

  1. Installed Merchello
  2. Installed FastTrack
  3. Played around by adding new shiny products
  4. Removed the FastTrack doctypes
  5. Boom

It's b/c one of my items I created depended on a doctype that I deleted from the fast track types.

There should be a FK constraint between [merchDetachedContentType] contentTypeId and the doctype table that it is referring to in Umbraco.

So if I try to delete a piece of content that referenced, it'll hopefully stop the removal. Other option is to remove all products associated, but the cascading effect goes into other tables.

@kgiszewski

This comment has been minimized.

kgiszewski commented Mar 23, 2018

I resolved (for now I think) the error by editing the DB directly to remove the offending DetachedContent and Variants that were referenced.

@YodasMyDad YodasMyDad added the Bug label Oct 17, 2018

@YodasMyDad YodasMyDad added this to To Do in Merchello 2.7.0 Oct 17, 2018

@YodasMyDad YodasMyDad moved this from To Do to In Progress in Merchello 2.7.0 Oct 18, 2018

@YodasMyDad YodasMyDad removed this from In Progress in Merchello 2.7.0 Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment