Issue with Editor

Issue Summary

Hello everyone,

I’m encountering an issue with my Ghost installation where the editor fails to load for certain pages or posts. Instead of displaying the editor, I just see a blank screen. Strangely, this problem doesn’t occur for all pages or posts—some work perfectly fine while others don’t.

The error seems to indicate a JSON parsing issue.

Steps to Reproduce

  1. Login to Ghost admin panel
  2. Open “Pages” or “Posts”
  3. Click on “Edit page/edit post”

Setup information

Ghost Version
Version: 5.110.2
Environment: production

Node.js Version
v18.18.0

How did you install Ghost?
Self hosting

Provide details of your host & operating system
OS: Ubuntu 22.04.2 LTS
Hosting: netcup / KVM Server
Specs: 4 Core “QEMU Virtual CPU version 2.5+”, 4.1 GB RAM & 4.1 GB Swap

Database type
MySQL 8

Browser & OS version
Same problem on Windows, Linux, macOS (and in all other browser)

Relevant log / error output
Uncaught (in promise) SyntaxError: Expected ',' or '}' after property value in JSON at position 123 (line 1 column 124)

Is this a fresh install, or has it been recently upgraded? Were posts created on this install, or imported from elsewhere?

Anything to go along with the browser error in the ghost logs?

Any pattern for what posts/pages are impacted? Older? Newer? Random?

For one of the failing posts, can you use the network tab in your browser’s dev tools to inspect the request to the /ghost/api/admin/posts/{id}/ endpoint? If you look at the preview for that request you should have some content in the lexical property of the first post - please share that if it’s not confidential

2 Likes

Ok, so there’s definitely something weird going on with the header card there. Seems like the contents are being incorrectly escaped somewhere along the line :thinking:

I’ve not been able to reproduce that so far myself.

How are you creating those header cards? Are you inserting them manually whilst editing or are they copy/pasted?

Also, do you have anything in your network stack that could be modifying the network responses? Maybe some security-related thing on your host or at an edge (e.g. some Cloudflare security stuff)?

Could this be causing the issue?

Potentially, yes, depending on which firewall features you have enabled. You could always try turning off the orange cloud and running the same test again - creating a header card as you were previously and trying to open the post - to see if there’s any difference.

What’s confusing here is that we’ve not been able to reproduce the issue and haven’t had any other reports which is pointing towards there being something odd with your setup that’s causing the issue. Especially as you appear to get HTML-escaped content in there somehow.

The lexical field is stringified JSON. The content that the editor creates for the header card text typically looks like this when correctly escaped (this is what I’m seeing when testing):

\"header\":\"<span style=\\\"white-space: pre-wrap;\\\">Testing</span><br><span style=\\\"white-space: pre-wrap;\\\">test</span>\",

Can you check what the editor is saving for you? With the network inspector open, create a post and add the header card with some text. After that can you find the last PUT request to the /posts/{id}/ endpoint and share what is in the posts[0].lexical field?

Just to make sure, is that the content from the data sent (Payload) or the data received (Response)?

That the put request is messed up suggests the Koenig editor or the browser.
What browser and OS are you using? Do you have another browser installed you could try to replicate this with?

1 Like

Failing that, the same browser in incognito (to ensure extensions are disabled) is also a good test.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.