Getting mobiledoc-lexical error post install

Issue Summary

  • After installing with the docker version, I can’t add a single post, getting an error spamming in the logs every time I type a character :

  • What did you expect to happen?
    That I could type a post and get it to work :slight_smile:

Steps to Reproduce

  1. Deploy docker version
  2. Try to type a post

Setup information

Ghost Version

Ghost-CLI version: 1.23.1
Ghost version: 5.22.10 (at /var/lib/ghost)

Node.js Version
Docker version

How did you install Ghost?
Docker image. docker compose looks like this:
docker-compose pastebin

Provide details of your host & operating system
Irrelevant as part of Docker image

Database type
MariaDB linuxserver latest image

Browser & OS version
N/A

Relevant log / error output

[2022-11-15 09:01:04] ERROR "POST /ghost/api/admin/posts/?formats=mobiledoc%2Clexical" 400 28ms

Could not understand request.

Error ID:
    09271fc0-64c4-11ed-a53e-71ddf47c352e

Error Code:
    ER_BAD_FIELD_ERROR

----------------------------------------

Error: select `posts`.*, (with `k` as (select `member_id` from `members_subscription_created_events` where posts.id = members_subscription_created_events.attribution_id union select `member_id` from `members_created_events` where posts.id = members_created_events.attribution_id) select count(*) from `k`) as `count__conversions`, `posts`.*, (select count(distinct `members_click_events`.`member_id`) from `members_click_events` inner join `redirects` on `members_click_events`.`redirect_id` = `redirects`.`id` where posts.id = redirects.post_id) as `count__clicks`, `posts`.*, (select COALESCE(ROUND(AVG(score) * 100), 0) from `members_feedback` where posts.id = members_feedback.post_id) as `count__sentiment`, `posts`.*, (select count(*) from `members_feedback` where posts.id = members_feedback.post_id AND members_feedback.score = 0) as `count__negative_feedback`, `posts`.*, (select sum(`score`) from `members_feedback` where posts.id = members_feedback.post_id) as `count__positive_feedback` from `posts` where `posts`.`id` = '6373555064e8590001afb17d' limit 1 - Unknown column 'posts.id' in 'where clause'
    at Child.<anonymous> (/var/lib/ghost/versions/5.22.10/core/server/models/base/plugins/crud.js:175:31)
    at Packet.asError (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/packets/packet.js:728:17)
    at Query.execute (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/commands/command.js:29:26)
    at Connection.handlePacket (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/connection.js:456:32)
    at PacketParser.onPacket (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/connection.js:85:12)
    at PacketParser.executeStart (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/var/lib/ghost/versions/5.22.10/node_modules/mysql2/lib/connection.js:92:25)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)

Please see the docs for this error: Resolving a misconfigured MySQL database with Ghost - Ghost Developers

You will also need to switch to MySQL 8 as MariaDB is not a supported DB.

Thanks for your answer. I will take a look at switching, as the Bad Field Error is not due to ANSI :

STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Switched to mysql8, issue disappeared, thanks a lot !

1 Like