Class "Book" not found #3771

Closed
opened 2026-02-05 07:24:45 +03:00 by OVERLORD · 15 comments
Owner

Originally created by @jkonecny75 on GitHub (May 1, 2023).

Describe the Bug

After the update, some books report an error (see screenshot)

Steps to Reproduce

  • use IMG lscr.io/linuxserver/bookstack:v21.12.5-ls1
  • create a book with pages
  • update on IMG lscr.io/linuxserver/bookstack:v22.11.1-ls60
  • displaying a book causes an error (pages are OK)

Expected Behaviour

Show pages and books

Screenshots or Additional Context

image

Browser Details

110.0 (64-bit) Linux

Exact BookStack Version

v22.11.1

PHP Version

8.1.14

Hosting Environment

Ubuntu 20.04.4 LTS
docker-compose 1.25.4
docker 20.10.12

Originally created by @jkonecny75 on GitHub (May 1, 2023). ### Describe the Bug After the update, some books report an error (see screenshot) ### Steps to Reproduce - use IMG `lscr.io/linuxserver/bookstack:v21.12.5-ls1` - create a book with pages - update on IMG `lscr.io/linuxserver/bookstack:v22.11.1-ls60` - displaying a book causes an error (pages are OK) ### Expected Behaviour Show pages and books ### Screenshots or Additional Context ![image](https://user-images.githubusercontent.com/19643783/235376482-a6df7606-d30b-4f1f-ad14-3576e9d28578.png) ### Browser Details 110.0 (64-bit) Linux ### Exact BookStack Version v22.11.1 ### PHP Version 8.1.14 ### Hosting Environment Ubuntu 20.04.4 LTS docker-compose 1.25.4 docker 20.10.12
OVERLORD added the 🐕 Support label 2026-02-05 07:24:45 +03:00
Author
Owner

@jkonecny75 commented on GitHub (May 1, 2023):

stack_trace.txt

@jkonecny75 commented on GitHub (May 1, 2023): [stack_trace.txt](https://github.com/BookStackApp/BookStack/files/11362427/stack_trace.txt)
Author
Owner

@ssddanbrown commented on GitHub (May 1, 2023):

Hi @jkonecny75, A few notes:

  • Just an FYI, I do not manage the linuxserver container myself (Not an official part of the project) but happy to attempt to support.
  • Can you try on the latest version of the container? Rather than one for an old release. There may have been issues which have since been patched.
  • If possible, could you provide the docker-compose.yml config in use here so I can gain a full view of how the container is used, and how volumes are mapped?
@ssddanbrown commented on GitHub (May 1, 2023): Hi @jkonecny75, A few notes: - Just an FYI, I do not manage the linuxserver container myself (Not an official part of the project) but happy to attempt to support. - Can you try on the latest version of the container? Rather than one for an old release. There may have been issues which have since been patched. - If possible, could you provide the `docker-compose.yml` config in use here so I can gain a full view of how the container is used, and how volumes are mapped?
Author
Owner

@jkonecny75 commented on GitHub (May 2, 2023):

Hi @ssddanbrown, thank you for your willingness

I tried the last version as a first option. After the error 'Class "Book" not found' I tried individual versions from 21.12.5-ls1.

Version v22.11.1-ls60 is the first version to throw this bug

docker-compose.yaml:

version: "3"

services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:v21.12.5-ls1
    #image: lscr.io/linuxserver/bookstack:v23.02.3-ls75
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL="https://wiki.ourcompany.loc"
      - APP_DEBUG=true
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS=bookstack
      - DB_DATABASE=bookstack
      - AUTH_METHOD=ldap
      - LDAP_SERVER="192.168.1.1"
      - LDAP_BASE_DN="dc=ourcompany,dc=loc"
      - LDAP_VERSION="3"
      - LDAP_ID_ATTRIBUTE=sAMAccountName
      - LDAP_USER_FILTER=(&(sAMAccountName=$${user}))
      - LDAP_EMAIL_ATTRIBUTE=mail
      - LDAP_DISPLAY_NAME_ATTRIBUTE=cn
      - LDAP_DN=auth@ad.ourcompany.loc
      - LDAP_PASS=ourPasswd
    volumes:
      - ./data:/config
    ports:
      - "443:443"
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=mysqlroot
      - TZ=Europe/Prague
      - MYSQL_DATABASE=bookstack
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=bookstack
    restart: unless-stopped
    volumes:
      - ./data/:/config
@jkonecny75 commented on GitHub (May 2, 2023): Hi @ssddanbrown, thank you for your willingness I tried the last version as a first option. After the error 'Class "Book" not found' I tried individual versions from 21.12.5-ls1. Version v22.11.1-ls60 is the first version to throw this bug _docker-compose.yaml_: ```yaml version: "3" services: bookstack: image: lscr.io/linuxserver/bookstack:v21.12.5-ls1 #image: lscr.io/linuxserver/bookstack:v23.02.3-ls75 container_name: bookstack environment: - PUID=1000 - PGID=1000 - APP_URL="https://wiki.ourcompany.loc" - APP_DEBUG=true - DB_HOST=bookstack_db - DB_USER=bookstack - DB_PASS=bookstack - DB_DATABASE=bookstack - AUTH_METHOD=ldap - LDAP_SERVER="192.168.1.1" - LDAP_BASE_DN="dc=ourcompany,dc=loc" - LDAP_VERSION="3" - LDAP_ID_ATTRIBUTE=sAMAccountName - LDAP_USER_FILTER=(&(sAMAccountName=$${user})) - LDAP_EMAIL_ATTRIBUTE=mail - LDAP_DISPLAY_NAME_ATTRIBUTE=cn - LDAP_DN=auth@ad.ourcompany.loc - LDAP_PASS=ourPasswd volumes: - ./data:/config ports: - "443:443" restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db environment: - PUID=1000 - PGID=1000 - MYSQL_ROOT_PASSWORD=mysqlroot - TZ=Europe/Prague - MYSQL_DATABASE=bookstack - MYSQL_USER=bookstack - MYSQL_PASSWORD=bookstack restart: unless-stopped volumes: - ./data/:/config ```
Author
Owner

@ssddanbrown commented on GitHub (May 2, 2023):

Thanks for the info @jkonecny75.

So looking further, this appears to me like it might be a database migration issue.
If your database did not previously migrate correctly then it may have old references that cannot be properly resolved.

Using the latest linuxserver image, can you provide the start-up logs for the bookstack container?
I just want to see the steps it's making and confirm how the migrations are behaving.

@ssddanbrown commented on GitHub (May 2, 2023): Thanks for the info @jkonecny75. So looking further, this appears to me like it might be a database migration issue. If your database did not previously migrate correctly then it may have old references that cannot be properly resolved. Using the latest linuxserver image, can you provide the start-up logs for the bookstack container? I just want to see the steps it's making and confirm how the migrations are behaving.
Author
Owner

@jkonecny75 commented on GitHub (May 2, 2023):

I used IMG lscr.io/linuxserver/bookstack:v23.02.3-ls75. Here is start-up.log

FYI: The URL http://wiki.ourcompany.cz:8080 is only a debug URL for the upgrade, which means that this step is not performed in the production environment

@jkonecny75 commented on GitHub (May 2, 2023): I used IMG `lscr.io/linuxserver/bookstack:v23.02.3-ls75`. Here is [start-up.log](https://github.com/BookStackApp/BookStack/files/11372790/wiki.log) > FYI: The URL _http://wiki.ourcompany.cz:8080_ is only a debug URL for the upgrade, which means that this step is not performed in the production environment
Author
Owner

@ssddanbrown commented on GitHub (May 2, 2023):

Hi @jkonecny75,
Did you revert back before running to get that log? Just curious since it looks like there had not be a pre-existing attempt at upgrade there.

During that run for the provided logs it looks like the database is migrating fine so should hopefully be in a working state after going through those migrations. Did that instance (For which the logs have been provided for) specifically show the exact same error after starting up?

@ssddanbrown commented on GitHub (May 2, 2023): Hi @jkonecny75, Did you revert back before running to get that log? Just curious since it looks like there had not be a pre-existing attempt at upgrade there. During that run for the provided logs it looks like the database is migrating fine so should hopefully be in a working state after going through those migrations. Did that instance (For which the logs have been provided for) specifically show the exact same error after starting up?
Author
Owner

@jkonecny75 commented on GitHub (May 2, 2023):

Hi @ssddanbrown,

I reverted back DB and other files to snapshot at version v21.12.5-ls1 and executed up with IMG v23.02.3-ls75. That log is the first within the upgrade.

The error is unfortunately the same :-(

@jkonecny75 commented on GitHub (May 2, 2023): Hi @ssddanbrown, I reverted back DB and other files to snapshot at version v21.12.5-ls1 and executed up with IMG v23.02.3-ls75. That log is the first within the upgrade. The error is unfortunately the same :-(
Author
Owner

@ssddanbrown commented on GitHub (May 2, 2023):

@jkonecny75 Ah, very strange. Seems like for some reason some data in the database is not being altered as expected by the migrations.

  • Would you be able to provide the stack trace, as provided before, but for the version using the recent docker image?
  • If asked, are you comfortable with accessing the database container and running mysql commands?
@ssddanbrown commented on GitHub (May 2, 2023): @jkonecny75 Ah, very strange. Seems like for some reason some data in the database is not being altered as expected by the migrations. - Would you be able to provide the stack trace, as provided before, but for the version using the recent docker image? - If asked, are you comfortable with accessing the database container and running mysql commands?
Author
Owner

@jkonecny75 commented on GitHub (May 2, 2023):

  • Would you be able to provide the stack trace, as provided before, but for the version using the recent docker image?

Do you mean v23.02.3-ls76 instead v23.02.3-ls75 ? The log is exactly the same as before :-/

  • If asked, are you comfortable with accessing the database container and running mysql commands?

Absolute no problem ;-)

@jkonecny75 commented on GitHub (May 2, 2023): > * Would you be able to provide the stack trace, as provided before, but for the version using the recent docker image? Do you mean v23.02.3-ls76 instead v23.02.3-ls75 ? The log is exactly the same as before :-/ > * If asked, are you comfortable with accessing the database container and running mysql commands? Absolute no problem ;-)
Author
Owner

@ssddanbrown commented on GitHub (May 3, 2023):

@jkonecny75 Alrighty, can you run the following query and report back the results provided back by MySQL:

select entity_type from activities group by entity_type;
@ssddanbrown commented on GitHub (May 3, 2023): @jkonecny75 Alrighty, can you run the following query and report back the results provided back by MySQL: ```sql select entity_type from activities group by entity_type; ```
Author
Owner

@jkonecny75 commented on GitHub (May 3, 2023):

MariaDB [bookstack]> select entity_type from activities group by entity_type;

+-------------+
| entity_type |
+-------------+
| NULL        |
| Book        |
| bookshelf   |
| chapter     |
| helf        |
| Page        |
| pter        |
+-------------+

... but I can see entity_type like book, page .... is it OK ? ... it seems like case insensitive

@jkonecny75 commented on GitHub (May 3, 2023): ```shell MariaDB [bookstack]> select entity_type from activities group by entity_type; +-------------+ | entity_type | +-------------+ | NULL | | Book | | bookshelf | | chapter | | helf | | Page | | pter | +-------------+ ``` ... but I can see entity_type like `book`, `page` .... is it OK ? ... it seems like case insensitive
Author
Owner

@jkonecny75 commented on GitHub (May 3, 2023):

After command UPDATE activities SET entity_type = 'book' WHERE entity_type = 'Book'; that error is fixed :-D

Thank You very very much @ssddanbrown

@jkonecny75 commented on GitHub (May 3, 2023): After command `UPDATE activities SET entity_type = 'book' WHERE entity_type = 'Book';` that error is fixed :-D Thank You very very much @ssddanbrown
Author
Owner

@ssddanbrown commented on GitHub (May 3, 2023):

Glad to hear this is now solved @jkonecny75.
Bit concerning though, not sure why you'd have those values in the database, especially those truncated references like pter and helf.

Keep in mind that many other columns also went through the same changes during the migrations you ran through, so whatever's occured here may affect other parts of the app/database.

Below is the migration file that performed changes to these columns, showing a list of the tables and columns where these kind of values existed. Just sharing in the event further future investigation is required upon similar issues.

57bdd83d8c/database/migrations/2022_04_25_140741_update_polymorphic_types.php (L21-L31)

@ssddanbrown commented on GitHub (May 3, 2023): Glad to hear this is now solved @jkonecny75. Bit concerning though, not sure why you'd have those values in the database, especially those truncated references like `pter` and `helf`. Keep in mind that many other columns also went through the same changes during the migrations you ran through, so whatever's occured here may affect other parts of the app/database. Below is the migration file that performed changes to these columns, showing a list of the tables and columns where these kind of values existed. Just sharing in the event further future investigation is required upon similar issues. https://github.com/BookStackApp/BookStack/blob/57bdd83d8c0e529ccc3095c54fba0ca4cd1e02fe/database/migrations/2022_04_25_140741_update_polymorphic_types.php#L21-L31
Author
Owner

@jkonecny75 commented on GitHub (May 3, 2023):

Ah, if I understand correctly the helf should be bookshelf and the pter should be chapter, right?
I'll check the whole DB just in case.

Thank You again for your help @ssddanbrown

@jkonecny75 commented on GitHub (May 3, 2023): Ah, if I understand correctly the _helf_ should be _bookshelf_ and the _pter_ should be _chapter_, right? I'll check the whole DB just in case. Thank You again for your help @ssddanbrown
Author
Owner

@ssddanbrown commented on GitHub (May 3, 2023):

@jkonecny75 Yeah, I believe so but again, not sure how it's got to that state to begin with.

@ssddanbrown commented on GitHub (May 3, 2023): @jkonecny75 Yeah, I believe so but again, not sure how it's got to that state to begin with.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3771