wallabag icon indicating copy to clipboard operation
wallabag copied to clipboard

New Install: "500 Internal Server Error"

Open brian-christie opened this issue 5 months ago • 4 comments

Environment

  • Version: 2.6.13
  • Installation: Docker-compose
  • PHP version:
  • OS: ubuntu 22.04 (via docker)
  • Database: mariadb:11.8.2-noble (docker container)
  • Parameters:
My app/config/parameters.yml is:
  database_driver: pdo_mysql
  database_host: db
  database_port: 3306
  database_name: wallabag
  database_user: wallabag
  database_password: 'myDbPassword'
  database_path: '%kernel.project_dir%/data/db/wallabag.sqlite'
  database_table_prefix: wallabag_
  database_socket: null
  database_charset: utf8mb4
  domain_name: 'http://wallabag.reallogic.lo'
  server_name: wallabag.reallogic.lo
  mailer_dsn: 'smtp://127.0.0.1'
  locale: en
  secret: mySecret
  twofactor_sender: [email protected]
  fosuser_registration: false
  fosuser_confirmation: true
  fos_oauth_server_access_token_lifetime: 3600
  fos_oauth_server_refresh_token_lifetime: 1209600
  from_email: [email protected]
  rss_limit: 50
  rabbitmq_host: localhost
  rabbitmq_port: 5672
  rabbitmq_user: guest
  rabbitmq_password: guest
  rabbitmq_prefetch_count: 10
  redis_scheme: tcp
  redis_host: redis
  redis_port: 6379
  redis_path: null
  redis_password: null
  sentry_dsn: null

What steps will reproduce the bug?

With this docker-compose.yaml file:

version: '3'
services:
  wallabag:
    image: wallabag/wallabag:2.6.13
    restart: unless-stopped
    networks:
      - proxy
      - wallabag
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PW}
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
      - SYMFONY__ENV__DATABASE_HOST=db
      - SYMFONY__ENV__DATABASE_PORT=3306
      - SYMFONY__ENV__DATABASE_NAME=${DB_NAME}
      - SYMFONY__ENV__DATABASE_USER=${DB_USER}
      - SYMFONY__ENV__DATABASE_PASSWORD=${DB_PASSWORD}
      - SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
      - SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
      - SYMFONY__ENV__MAILER_DSN=smtp://127.0.0.1
      - SYMFONY__ENV__FROM_EMAIL=${FROM_EMAIL}
      - SYMFONY__ENV__DOMAIN_NAME=${DOMAIN_NAME}
      - SYMFONY__ENV__SERVER_NAME=${SERVER_NAME}
    ports:
      - 80
    volumes:
      - ${IMAGE_LOCATION}:/var/www/wallabag/web/assets/images
    healthcheck:
      test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost/api/info"]
      interval: 1m
      timeout: 3s
    depends_on:
      - db
      - redis
  db:
    image: mariadb:11.8.2-noble
    restart: unless-stopped
    networks:
      - wallabag
    environment:
      - MARIADB_ROOT_PASSWORD=${MYSQL_ROOT_PW}
      - MARIADB_USER=${DB_USER}
      - MARIADB_PASSWORD=${DB_PASSWORD}
      - MARIADB_DATABASE=${DB_NAME}
    ports:
      - 3306
    volumes:
      - ${DATA_LOCATION}:/var/lib/mysql
    healthcheck:
      test: ["CMD", "/usr/local/bin/healthcheck.sh", "--innodb_initialized"]
      interval: 20s
      timeout: 3s
  redis:
    image: redis:alpine
    restart: unless-stopped    
    networks:
      - wallabag
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 20s
      timeout: 3s

networks:
  wallabag:
    external: false
  proxy:
    external:
      name: proxy

There is an appropriate .env file setting the variables.

All services / containers start up and seem to be working just fine. No errors are reported in any of the containers' logs.

When I navigate to http://wallabag.reallogic.lo the browser is redirected to http:/wallabag.reallogic.lo/login. At this point, I receive an "Oops! An Error Has Occurred The server returned a "500 Internal Server Error"." message.

The last few lines of the wallabag service log are:

wallabag_1  | ::1 - - [09/Jul/2025:23:44:06 +0000] "GET /api/info HTTP/1.1" 200 81 "-" "Wget"
wallabag_1  | ::1 - - [09/Jul/2025:23:45:06 +0000] "GET /api/info HTTP/1.1" 200 81 "-" "Wget"
wallabag_1  | ::ffff:172.28.0.3 - - [09/Jul/2025:23:45:57 +0000] "GET /login HTTP/1.0" 500 519 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
wallabag_1  | ::1 - - [09/Jul/2025:23:46:06 +0000] "GET /api/info HTTP/1.1" 200 81 "-" "Wget"

The server does log the 500 amongst all the 200s for the heartbeat.

Navigating the browser to http://wallabag.reallogic.lo/api/info I receive:

{"appname":"wallabag","version":"2.6.13","allowed_registration":false}

which looks like a valid response.

Results are the same if I use Firefox or Chromium. Results are the same if I go through the nginx proxy container or if I have the wallabag container expose port 80 directly.

brian-christie avatar Jul 09 '25 23:07 brian-christie

Can you check for logs in /var/www/wallabag/var/logs instead?

j0k3r avatar Jul 10 '25 09:07 j0k3r

So that log was definitely more helpful. It is now pointing to the database, or at least the communications to the database. The log has lots of these repeated.

   1   │ [2025-07-09T16:40:09.545306+00:00] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_para
       │ meters":{"_route":"fos_user_security_login","_controller":"fos_user.security.controller::loginAction"},"request_uri":"http://wallabag.re
       │ allogic.lo/login","method":"GET"} []
   2   │ [2025-07-09T16:40:09.558897+00:00] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
   3   │ [2025-07-09T16:40:09.735293+00:00] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown durin
       │ g the rendering of a template ("An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table
       │  'wallabag.wallabag_internal_setting' doesn't exist")." at /var/www/wallabag/src/Wallabag/CoreBundle/Resources/views/base.html.twig line
       │  78 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"An ex
       │ ception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wallabag.wallabag_internal_setting'
       │  doesn't exist\"). at /var/www/wallabag/src/Wallabag/CoreBundle/Resources/views/base.html.twig:78)\n[previous exception] [object] (Doctr
       │ ine\\DBAL\\Exception\\TableNotFoundException(code: 1146): An exception occurred while executing a query: SQLSTATE[42S02]: Base table or 
       │ view not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendor/doctrine/dbal/src/Driver/API/M
       │ ySQL/ExceptionConverter.php:49)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1146): SQLSTATE[42S02]: Bas
       │ e table or view not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendor/doctrine/dbal/src/D
       │ river/PDO/Exception.php:24)\n[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 11
       │ 46 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"
       │ } []
   4   │ [2025-07-09T16:40:09.757962+00:00] request.CRITICAL: Exception thrown when handling an exception (Twig\Error\RuntimeError: An exception 
       │ has been thrown during the rendering of a template ("An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view 
       │ not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist"). at /var/www/wallabag/src/Wallabag/CoreBundle/Resources/views
       │ /base.html.twig line 78) {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering o
       │ f a template (\"An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wallabag.walla
       │ bag_internal_setting' doesn't exist\"). at /var/www/wallabag/src/Wallabag/CoreBundle/Resources/views/base.html.twig:78)\n[previous excep
       │ tion] [object] (Doctrine\\DBAL\\Exception\\TableNotFoundException(code: 1146): An exception occurred while executing a query: SQLSTATE[4
       │ 2S02]: Base table or view not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendor/doctrine/
       │ dbal/src/Driver/API/MySQL/ExceptionConverter.php:49)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1146):
       │  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendo
       │ r/doctrine/dbal/src/Driver/PDO/Exception.php:24)\n[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table 
       │ or view not found: 1146 Table 'wallabag.wallabag_internal_setting' doesn't exist at /var/www/wallabag/vendor/doctrine/dbal/src/Driver/PD
       │ O/Statement.php:130)"} []

Further digging tells me that the database wallabag was created, but it is empty (i.e. there are no tables). From the cli I can log into the database as both users, root and wallabag with the appropriate passwords set in the docker-compose.yaml. It's been a while since I've worked deeply in a db, but I think the % means 'any host', right?

MariaDB [(none)]> select user, host from mysql.user;
+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| root        | %         |
| wallabag    | %         |

And the only thing the user wallabag can't do on the wallabag db is grant access.

MariaDB [(none)]> select * from mysql.db;
+------+----------+----------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+---------------------+--------------------------+
| Host | Db       | User     | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv | Event_priv | Trigger_priv | Delete_history_priv | Show_create_routine_priv |
+------+----------+----------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+---------------------+--------------------------+
| %    | wallabag | wallabag | Y           | Y           | Y           | Y           | Y           | Y         | N          | Y               | Y          | Y          | Y                     | Y                | Y                | Y              | Y                   | Y                  | Y            | Y          | Y            | Y                   | Y                        |
+------+----------+----------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+------------+--------------+---------------------+--------------------------+

brian-christie avatar Jul 10 '25 13:07 brian-christie

I have the same issue, but with postgresql.

I resolved it by running (stolen from here):

docker exec wallabag /var/www/wallabag/bin/console doctrine:migrations:migrate --env=prod --no-interaction

This apparently does not create the default wallabag;wallabag user, so I created one myself:

docker exec wallabag /var/www/wallabag/bin/console --env=prod fos:user:create <name> <email> <initial password> --super-admin

felixarmbruster avatar Aug 09 '25 09:08 felixarmbruster

@brian-christie which documentation have you followed to install? so I can check it

yguedidi avatar Aug 24 '25 10:08 yguedidi