Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status 500 "Error calling /en/." since 1.16.0 #871

Open
Kabelkrant opened this issue Feb 24, 2025 · 19 comments
Open

Status 500 "Error calling /en/." since 1.16.0 #871

Kabelkrant opened this issue Feb 24, 2025 · 19 comments
Labels
bug Something isn't working

Comments

@Kabelkrant
Copy link

Kabelkrant commented Feb 24, 2025

Describe the bug
Since upgrading to 1.16.0, almost every page displays an error 500. It states:

error (Status 500)
Error calling /en/.
Try to reload the page or contact the administrator if this error persists.

To Reproduce
Steps to reproduce the behavior:

  1. On Synology Docker, run jbtronics/part-db1 version 1.15.2
  2. Upgrade docker image to 1.16.0
  3. Run php bin/console doctrine:migrations:migrate as user www-data, type Yes, migation succesful
  4. Visit part-db in the browser and login
  5. Error pops up

The error message advises to run php bin/console cache:clear but this does not help.

Screenshots
https://postimg.cc/4YYQJtnW

Server Side
Host 10.0.20.2

  • Synology DSM 7.2.2 docker
  • jbtronics/part-db1:latest (port mapping 8091:80, see docker-compose below)

Host 10.0.20.4

Desktop:

  • Windows 10, Firefox 135

Additional context
My docker-compose is:

version: '3.3'
services:
  partdb:
    container_name: partdb
    ports:
      - '8091:80'
    volumes:
      - /volume1/docker/partdb/uploads:/var/www/html/uploads
      - /volume1/docker/partdb/public_media:/var/www/html/public/media
      - /volume1/docker/partdb/db:/var/www/html/var/db
    restart: unless-stopped
    image: jbtronics/part-db1:latest
    environment:
      - DATABASE_URL=mysql://stuff:(password)@10.0.20.4:3306/stuff
      - APP_ENV=docker
      - DEFAULT_LANG=en
      - DEFAULT_TIMEZONE=Europe/Amsterdam
      - BASE_CURRENCY=EUR
      - INSTANCE_NAME=Kabelkrant Inventaris
      - ALLOW_ATTACHMENT_DOWNLOADS=0
      - USE_GRAVATAR=0
      - DEFAULT_URI=https://stuff.home.kabelkrant.net
      - TRUSTED_PROXIES=10.0.20.0/16
      - BANNER=Welkom!

@Kabelkrant Kabelkrant added the bug Something isn't working label Feb 24, 2025
@jbtronics
Copy link
Member

What do the logs of Part-DB says? It will explain what the 500 error means

@Kabelkrant
Copy link
Author

Kabelkrant commented Feb 24, 2025

I couldn't access the logs, as the logs are maybe inside the docker container instead of a mounted folder?
I could however capture the STDOUT of the docker container.

Please see the attached file (it's HTML). It starts at the bottom going up.

partdb_session.txt

Edit: This line:

[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.internal_path' in 'SELECT' at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:55)

@tpazdera
Copy link

Same exact issue.....

  • Environment - Docker container on Synology Diskstation
  • Upgraded to Part-DB 1.16.0
  • Ran command to upgrade database
root@DiskStation:~# docker exec -it c340ad8728f8 bash
root@70e8d56cb8ea:/var/www/html# 
root@70e8d56cb8ea:/var/www/html# sudo -H -u www-data bash -c 'php bin/console doctrine:migrations:migrate'

 WARNING! You are about to execute a migration in database "main" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > yes

[notice] Migrating up to DoctrineMigrations\Version20250222165240
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version1 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20190902140506 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20190913141126 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20190924113252 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20191214153125 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20200126191823 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20200311204104 was executed but did not result in any SQL statements.
[warning] Migration not needed for SQLite. Skipping...
[warning] Migration DoctrineMigrations\Version20200409130946 was executed but did not result in any SQL statements.
[warning] 
[warning] The initial password for the "admin" user is: 1e3c5ea937
[warning] 
[warning] Migration DoctrineMigrations\Version20230417211732 was executed but did not result in any SQL statements.
[warning] Migration DoctrineMigrations\Version20240728145604 was executed but did not result in any SQL statements.
[notice] finished in 1599.4ms, used 36.5M memory, 32 migrations executed, 1067 sql queries
                                                                                                                        
 [OK] Successfully migrated to version: DoctrineMigrations\Version20250222165240
  • Received Internal Server Error 500 errors
  • Most sections of Part-DB are now inaccessible
  • Tried to clear cache as a potential fix to no avail.
root@70e8d56cb8ea:/var/www/html# sudo -H -u www-data bash -c 'php bin/console cache:clear'                

 // Clearing the cache for the prod environment with debug false                                                        
                                                                                                                        
 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.        

Found line in error log which indicates a database schema problem..
[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.internal_path' in 'field list' at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:55)

@jbtronics
Copy link
Member

In both cases it appears, that he cant find the internal_path column for the attachments. This one was introduced with the changed attachment system and should be created by the database migration.

You should check if that the database attachments table contain an internal_path and external_path and no path column.

In my private instance and the demo instance the new Part-DB and the required migration works fine...

@Kabelkrant
Copy link
Author

Kabelkrant commented Feb 24, 2025

The migration script told me it was succesful, just like tpazdera but indeed in my attachments table I only have the path column.

Image

@kilrah
Copy link

kilrah commented Feb 24, 2025

Same problem

[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1): SQLSTATE[HY000]: General error: 1 no such column: t0.internal_path at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:24)

I saw there were migrations to perform, did so and cleared cache but no change and the column isn't there.

Image

Using the Docker container on Unraid with sqlite.

@sergeyyarkov
Copy link

sergeyyarkov commented Feb 24, 2025

I'm just trying to copy the app.db file from version 1.14.5 to version 1.16.0 and I can't because the attachments table doesn't have internal_path and external_path columns. How can I export the database? I tried to export to json format in the web interface, but my pictures and documents are not loaded when imported and I get a 404 error. Perhaps this is due to a path conflict in url???? on the old version the path to the file looks like this: /media/part/datasheet.pdf but in the new version the response is 302 and in the end I get 404 =(((((

@kilrah
Copy link

kilrah commented Feb 24, 2025

Edit: Now see that this was in the mySQL function and the sqlite one was more elaborate... but it worked anyway as far as I can tell. Probably don't do that in your setup.

From what I can see it chokes on

//Create the new columns as nullable (that is easier modifying them)
        $this->addSql('ALTER TABLE attachments ADD internal_path VARCHAR(255) DEFAULT NULL, ADD external_path VARCHAR(255) DEFAULT NULL');

not liking the 2 statements in one, threw an error in my sqlite editor, I ran the whole block manually with that as 2 separate statements and it worked.

ALTER TABLE attachments ADD internal_path VARCHAR(255) DEFAULT NULL;  
ALTER TABLE attachments ADD external_path VARCHAR(255) DEFAULT NULL;
UPDATE attachments SET external_path=path;
ALTER TABLE attachments DROP path;
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%MEDIA#%%" ESCAPE "#";
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%BASE#%%" ESCAPE "#";
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%SECURE#%%" ESCAPE "#";
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%FOOTPRINTS#%%" ESCAPE "#";
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%FOOTPRINTS3D#%%" ESCAPE "#";
UPDATE attachments SET internal_path=external_path WHERE external_path LIKE "#%FOOTPRINTS3D#%%" ESCAPE "#";
UPDATE attachments SET external_path=NULL WHERE internal_path IS NOT NULL;

@jbtronics
Copy link
Member

What does php .\bin\console doctrine:migration:list output? The DoctrineMigrations\Version20250220215048 should have migrated status.

@tpazdera
Copy link

In my case I show that that version does have a migrated status.

| DoctrineMigrations\Version20250220215048 | migrated | 2025-02-24 12:35:54 | 0.003s | Split $path property for attachments into $internal_path and $external_path

jbtronics added a commit that referenced this issue Feb 24, 2025
@jbtronics
Copy link
Member

I have slightly changed the migration (into basically what @kilrah) reported as succesful. For MySQL this is bascially the same as before, for sqlite its slightly different, but this should normally not make a difference.

You can either take the latest commit from the repo master branch, or you wait until the docker image is built, and use the jbtronics/part-db1:master image, and try it out if it is working that way...

@partywagon112
Copy link

I'm unsure if this is the same issue, as I was only encountering Error 500 past /en/ pages where the database was referenced. This previous thread helped #648.

@Kabelkrant
Copy link
Author

Kabelkrant commented Feb 26, 2025

The problem persists in jbtronics/part-db1 version 1.16.1

I updated the docker image from 1.16.0 to 1.16.1

After the update I did the migration:

root@d974f80076a4:/var/www/html# sudo -u www-data php bin/console doctrine:migrat
ions:migrate                                                                     
                                                                                 
 WARNING! You are about to execute a migration in database "main" that could resu
lt in schema changes and data loss. Are you sure you wish to continue? (yes/no) [
yes]:                                                                            
 > yes                                                                           
                                                                                 
[notice] Migrating up to DoctrineMigrations\Version20250222165240                
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version1 was executed but did not result i
n any SQL statements.                                                            
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20190902140506 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20190913141126 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20190924113252 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20191214153125 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20200126191823 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20191214153125 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20200126191823 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20200311204104 was executed but did
 not result in any SQL statements.                                               
[warning] Migration not needed for SQLite. Skipping...                           
[warning] Migration DoctrineMigrations\Version20200409130946 was executed but did
 not result in any SQL statements.                                               
[warning]                                                                        
[warning] The initial password for the "admin" user is: _(password, redacted)_          
[warning]                                                                        
[warning] Migration DoctrineMigrations\Version20230417211732 was executed but did
 not result in any SQL statements.                                               
[warning] Migration DoctrineMigrations\Version20240728145604 was executed but did
 not result in any SQL statements.                                               
[notice] finished in 1371.6ms, used 36.5M memory, 32 migrations executed, 1060 sq
l queries                                                                        
                                                                                 
 [OK] Successfully migrated to version: DoctrineMigrations\Version20250222165240

After that, I logged back in to part-DB. The home page works and confirms i'm on 1.16.1, but give the same popup:

error (Status 500)
Error calling /en/.
Try to reload the page or contact the administrator if this error persists.

Image

Image

Every other page directly displays error 500.

The logs show this line:

[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.internal_path' in 'SELECT' at /var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:55)

Here is my full log (again HTML going bottom to top)

250226_partdb.txt

Do you need anything else?

@tpazdera
Copy link

I have the same issue. I upgraded to 1.16.1, re-ran the doctrine:migrate command. The messages claimed that the task was either not needed or no task "was executed but did not result in any SQL statements." However, all migration tasks completed successfully, confirmed by doctrine:list.

root@0f5fb4e2c62a:/var/www/html# sudo -H -u www-data bash -c 'php bin/console doctrine:migrations:list' | grep path
| DoctrineMigrations\Version20250220215048 | migrated | 2025-02-27 03:18:51 | 0.018s         | Split $path property for attachments into $internal_path and $external_path 

The attachments table still contains the old path...

MySQL [partdb]> desc attachments;
+-------------------+--------------+------+-----+-------------------+-------------------+
| Field             | Type         | Null | Key | Default           | Extra             |
+-------------------+--------------+------+-----+-------------------+-------------------+
| id                | int          | NO   | PRI | NULL              | auto_increment    |
| type_id           | int          | NO   | MUL | NULL              |                   |
| element_id        | int          | NO   | MUL | NULL              |                   |
| show_in_table     | tinyint(1)   | NO   |     | NULL              |                   |
| path              | varchar(255) | NO   |     | NULL              |                   |
| name              | varchar(255) | NO   | MUL | NULL              |                   |
| last_modified     | datetime     | NO   |     | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
| datetime_added    | datetime     | NO   |     | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
| class_name        | varchar(255) | NO   | MUL | NULL              |                   |
| original_filename | varchar(255) | YES  |     | NULL              |                   |
+-------------------+--------------+------+-----+-------------------+-------------------+
10 rows in set (0.003 sec)

Anything I am doing wrong?

@salvatoreraccardi
Copy link

Hi, I have the same issue.

Image Image

If I try to add a new part it does not work, only the categories, projects and basic information are saved correctly in the db.

MariaDB [partdb]> desc attachments;
+-------------------+--------------+------+-----+---------------------+----------------+
| Field             | Type         | Null | Key | Default             | Extra          |
+-------------------+--------------+------+-----+---------------------+----------------+
| id                | int(11)      | NO   | PRI | NULL                | auto_increment |
| type_id           | int(11)      | NO   | MUL | NULL                |                |
| element_id        | int(11)      | NO   | MUL | NULL                |                |
| show_in_table     | tinyint(1)   | NO   |     | NULL                |                |
| name              | varchar(255) | NO   | MUL | NULL                |                |
| last_modified     | datetime     | NO   |     | current_timestamp() |                |
| datetime_added    | datetime     | NO   |     | current_timestamp() |                |
| class_name        | varchar(255) | NO   | MUL | NULL                |                |
| original_filename | varchar(255) | YES  |     | NULL                |                |
| internal_path     | varchar(255) | YES  |     | NULL                |                |
| external_path     | varchar(255) | YES  |     | NULL                |                |
+-------------------+--------------+------+-----+---------------------+----------------+
11 rows in set (0.002 sec)

@kilrah
Copy link

kilrah commented Feb 27, 2025

The problem persists in jbtronics/part-db1 version 1.16.1

Same, I restored an old DB and tried upgrading it with the :master tag and it also did not work

@tpazdera
Copy link

@salvatoreraccardi It looks like you may have a different problem. This issue is specifically for the database issue where the attachments table has not been migrated to a later schema. My table has a "path" column, but yours has the updated "internal_path", "external_path".

There may be a new thing going on. You may have to check your logs and perhaps start a new issue.

@salvatoreraccardi
Copy link

@tpazdera You are right, I noticed it now thanks for the feedback. I did a fresh install and encountered the problem I reported in the comment above right away. I don't understand what I'm doing wrong.

@tpazdera
Copy link

I manually ran the update steps from @kilrah above, everything works fine for me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants