TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
46.97k stars 10.22k forks source link

Errors post migration to 5.74.3 to 5.88 #20694

Closed Stefatorus closed 1 month ago

Stefatorus commented 2 months ago

Issue Summary

One page of our site, respectively https://www.incorpo.ro/learn ( https://base-docs.incorpo.ro/learn for non-proxy translated version) is broken. Other pages like https://base-docs.incorpo.ro/manual work without a problem.

Unsure of the cause, it seems the post.js has remained (largely) similar. We have migrated from mariadb to mysql community, but all posts are fine and it even fixed issues that were due to mariadb 10 not being fully compatible with GhostCMS.

Steps to Reproduce

  1. Update from 5.74.3 to 5.88.2
  2. Potentially related to theme?
  3. Theree are some differences from what I've seen in the lexical dependency.

Ghost Version

5.88.2

Node.js Version

v18.19.0

How did you install Ghost?

Debian GNU/Linux 12 (bookworm), PCI-DSS hardened with level 2 - debian-cis OVH

Database type

MySQL 5.7

Browser & OS version

N/A

Relevant log / error output

Error: Minified Lexical error #38; visit https://lexical.dev/docs/error?code=38 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at prepareError (/var/www/ghost/versions/5.88.2/node_modules/@tryghost/mw-error-handler/lib/mw-error-handler.js:113:19)
    at n (/var/www/ghost/versions/5.88.2/node_modules/lexical/Lexical.prod.js:8:128)
    at Gf.setEditorState (/var/www/ghost/versions/5.88.2/node_modules/lexical/Lexical.prod.js:196:390)
    at LexicalHTMLRenderer.render (/var/www/ghost/versions/5.88.2/node_modules/@tryghost/kg-lexical-html-renderer/build/LexicalHTMLRenderer.js:67:16)
    at async Object.render (/var/www/ghost/versions/5.88.2/core/server/lib/lexical.js:105:16)
    at async Child.renderIfNeeded (/var/www/ghost/versions/5.88.2/core/server/models/post.js:392:26)
    at async Child.onFetched [as onFetchedCollection] (/var/www/ghost/versions/5.88.2/core/server/models/post.js:384:13)

Code of Conduct

Stefatorus commented 2 months ago

Some additional information:

routes:

# Trailing slash is a must for all of them.
collections:
  /:
    permalink: /
    template: landing
    filter: "tags:hash-landing"
    order: "published_at asc"
    rss: false
    limit: 30

  /product/lawfirms/:
    permalink: /
    template: landing
    filter: "tags:hash-products-consultancy"
    order: "published_at asc"
    rss: false
    limit: 30

  /ghidul-registratorului/:
    permalink: /ghidul-registratorului/{slug}/
    template: index
    data: page.ghidul-registratorului
    filter: "tags:hash-docs+tags:hash-registrator"

  /caen/:
    permalink: /caen/{slug}/
    template: index
    data: page.caen
    filter: "tags:hash-docs+tags:hash-caen"

  /learn/:
    permalink: /learn/{slug}/
    template: index
    data: page.learn
    filter: "tags:hash-docs+tags:hash-learn"

  /manual/:
    permalink: /manual/{slug}/
    template: index
    data: page.manual
    filter: "tags:hash-docs+tags:hash-manual"

  /laws/:
    permalink: /laws/{slug}/
    template: index
    data: page.laws
    filter: "tags:hash-laws"

  /tools/:
    permalink: /tools/{slug}/
    template: index
    data: page.tools
    filter: "tags:hash-docs+tags:hash-tools"

  /articles/:
    permalink: /articles/{slug}/
    template: blog
    data: page.articles
    filter: "tags:hash-article"

  /blog/:
    permalink: /blog/{slug}/
    template: blog
    data: page.blog
    filter: "tags:hash-blog-legacy"

  /changelog/:
    permalink: /changelog/{slug}/
    template: changelog
    data: page.changelog
    filter: "tags:hash-changelog"

  /press/:
    permalink: /press/{slug}/
    template: showcase
    data: page.press
    filter: "tags:hash-press"

  /roadmap/:
    permalink: /roadmap/{slug}/
    template: roadmap
    data: page.roadmap
    filter: "tags:hash-roadmap"
    order: "published_at asc"
    limit: "all"

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/
Stefatorus commented 2 months ago

Can confirm fix. The issue seems to have occured due to collection "docs" having articles with no content (empty articles pending to be written).

It might be a good idea to add validation in the future, to check if there is nothing in the lexical editor, and if so, keep empty html without erroring out.

sagzy commented 2 months ago

Hey @Stefatorus, thanks for writing in and sorry for the trouble you faced.

Am I correct in reading that the rendering issue with your page https://www.incorpo.ro/learn has now been fixed, and the issue can be closed?

It might be a good idea to add validation in the future, to check if there is nothing in the lexical editor, and if so, keep empty html without erroring out.

Thank you!

Stefatorus commented 1 month ago

You can close it, however it might be worth extra inspection if any empty post causes errors like this. Placeholders are common when preparing to build guides, etc. The issue should be easy to fix by either trying and catching such errors, or by checking if the context is empty beforehand.

Appreciate your quick reply. From my end, you can close it.

Best regards, Stefan

sagzy commented 1 month ago

Thanks @Stefatorus, I have added an issue to our backlog to keep track of that improvement idea