dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
803 stars 460 forks source link

Converted blocks failing to render- RefreshReferences is getting called even when the content is not json #28943

Open wezell opened 2 weeks ago

wezell commented 2 weeks ago

Parent Issue

No response

Problem Statement

I think this is happening when a field has been converted to a block from a wysiwyg but the content in the field is still HTML:

    at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: com.dotmarketing.exception.DotRuntimeException: An error occurred when refreshing Story Block Contentlet references in parent Content 'caa8601b-c6f4-49bc-814e-62b0b97f2551': Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
    at com.dotcms.contenttype.business.StoryBlockAPIImpl.refreshStoryBlockValueReferences(StoryBlockAPIImpl.java:116) ~[classes/:?]
    at org.apache.jsp.html.portlet.ext.contentlet.edit_005fcontentlet_jsp._jspService(edit_005fcontentlet_jsp.java:3809) ~[?:?]
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) ~[jasper.jar:9.0.85]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) ~[servlet-api.jar:4.0.FR]
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466) ~[jasper.jar:9.0.85]
    ... 154 more
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2481) ~[jackson-core-2.16.1.jar:2.16.1]
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:752) ~[jackson-core-2.16.1.jar:2.16.1]
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:676) ~[jackson-core-2.16.1.jar:2.16.1]
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2088) ~[jackson-core-2.16.1.jar:2.16.1]

Steps to Reproduce

  1. Create a content type with a wysiwyg
  2. Add a piece of content to this type, add some html to the wysiwyg
  3. Go back to the content type and convert the wysiwyg to a block field
  4. try to edit the content. You will get a stack trace.

Acceptance Criteria

Important fix - Refresh references should not cause/throw an error. We can log a warning, but it should not prevent the content from rendering or api calls, etc.

Additionally - we should skip the refreshReferences if the block content is not json

dotCMS Version

24.06.x

Proposed Objective

Quality Assurance

Proposed Priority

Priority 1 - Show Stopper

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

erickgonzalez commented 2 weeks ago

Not reproducible in LTS

wezell commented 2 weeks ago

No, but the infinity relationships being stored in the block are, unless you backported the fix from last week.

erickgonzalez commented 2 weeks ago

Are you referring to this one? https://github.com/dotCMS/core/issues/28659 If so, then yes, we will need to backport it, as it is currently queued for backporting.

fmontes commented 1 week ago

There are some videos in auth that can't be edited and seem related to this:

https://authoring.dotcms.com/dotAdmin/#/c/content/7c2fc123-dd3e-401b-812f-a8adab7b84ca

CleanShot 2024-06-21 at 09 57 00@2x

freddyDOTCMS commented 1 week ago

Pass Internal QA: Works as expeceted

josemejias11 commented 1 week ago

Failed: Tested on trunk_2b6105d, Docker, macOS 14.5, FF v126.0.1

I'm getting this error when reproducing this issue.

Screenshot 2024-06-27 at 11 34 44 AM
jdotcms commented 1 week ago

Hi @josemejias11 not sure if it is related to block editor or even the issue reported here, may be we can see it in another issue

josemejias11 commented 1 week ago

Hi @jdotcms, lets make @wezell the decider here. If he says the error can be review in another card. there's no problem on my end whatsoever. thanks!

wezell commented 1 week ago

@josemejias11, this is a different issue - we should open a card for it and add the jackson optional mapper to our ObjectMapper code.

josemejias11 commented 1 week ago

Approved: Tested on trunk_2b6105d, Docker, macOS 14.5, FF v126.0.1

The reported issue above will be covered on the card https://github.com/dotCMS/core/issues/29041