[GH-ISSUE #581] Error / Internal Server Error #454

Closed
opened 2026-02-25 21:31:57 +03:00 by kerem · 11 comments
Owner

Originally created by @tobasium on GitHub (Jan 19, 2024).
Original GitHub issue: https://github.com/ciur/papermerge/issues/581

Originally assigned to: @ciur on GitHub.

Hi i wantet to run papermerge but it did not work. Maybe someone could help me to solve the problem.
Did not see where exactly the problem is.

I use portainer and tested 2 different compose files:

Web App + Worker
PostgreSQL

Web App + Worker
for test i use the same data as in documentation.

papermerge starts

i try to login it loads and then it shows only error

i only see Error

Log in Docker:
sqlalchemy.exc.NoResultFound: No row was found when one was required


PostgreSQL (change username tobasium)

papermerge starts

i try to login

Under the pw field it shows:
Internal Server Error

Docker Log:
[SQL: SELECT core_user.id AS core_user_id, core_user.username AS core_user_username, core_user.email AS core_user_email, core_user.password AS core_user_password, core_user.is_superuser AS core_user_is_superuser, core_user.is_staff AS core_user_is_staff, core_user.is_active AS core_user_is_active, core_user.first_name AS core_user_first_name, core_user.last_name AS core_user_last_name, core_user.home_folder_id AS core_user_home_folder_id, core_user.inbox_folder_id AS core_user_inbox_folder_id, core_user.date_joined AS core_user_date_joined, core_user.created_at AS core_user_created_at, core_user.updated_at AS core_user_updated_at
FROM core_user
WHERE core_user.username = %(username_1)s
LIMIT %(param_1)s]
[parameters: {'username_1': 'tobasium', 'param_1': 1}]
(Background on this error at: https://sqlalche.me/e/20/f405)

Info:

  • Papermerge Version [e.g. 3.0.1]
Originally created by @tobasium on GitHub (Jan 19, 2024). Original GitHub issue: https://github.com/ciur/papermerge/issues/581 Originally assigned to: @ciur on GitHub. Hi i wantet to run papermerge but it did not work. Maybe someone could help me to solve the problem. Did not see where exactly the problem is. I use portainer and tested 2 different[ compose files](https://docs.papermerge.io/3.0/setup/docker-compose/): Web App + Worker PostgreSQL Web App + Worker for test i use the same data as in documentation. papermerge starts i try to login it loads and then it shows only error i only see Error Log in Docker: sqlalchemy.exc.NoResultFound: No row was found when one was required --------------------------------------------- PostgreSQL (change username tobasium) papermerge starts i try to login Under the pw field it shows: Internal Server Error Docker Log: [SQL: SELECT core_user.id AS core_user_id, core_user.username AS core_user_username, core_user.email AS core_user_email, core_user.password AS core_user_password, core_user.is_superuser AS core_user_is_superuser, core_user.is_staff AS core_user_is_staff, core_user.is_active AS core_user_is_active, core_user.first_name AS core_user_first_name, core_user.last_name AS core_user_last_name, core_user.home_folder_id AS core_user_home_folder_id, core_user.inbox_folder_id AS core_user_inbox_folder_id, core_user.date_joined AS core_user_date_joined, core_user.created_at AS core_user_created_at, core_user.updated_at AS core_user_updated_at FROM core_user WHERE core_user.username = %(username_1)s LIMIT %(param_1)s] [parameters: {'username_1': 'tobasium', 'param_1': 1}] (Background on this error at: https://sqlalche.me/e/20/f405) **Info:** - Papermerge Version [e.g. 3.0.1]
kerem 2026-02-25 21:31:57 +03:00
Author
Owner

@ciur commented on GitHub (Jan 20, 2024):

Can you please attach full webapp's docker log ?

Issue may be related (or even the same?) to Issue#579. In case it is same problem - well, I am currently working on it!

<!-- gh-comment-id:1902031267 --> @ciur commented on GitHub (Jan 20, 2024): Can you please attach full webapp's docker log ? Issue may be related (or even the same?) to [Issue#579](https://github.com/ciur/papermerge/issues/579). In case it is same problem - well, I am currently working on it!
Author
Owner

@tobasium commented on GitHub (Jan 20, 2024):

i will deploy both stacks and send you the log seperatly in 5 min

<!-- gh-comment-id:1902035583 --> @tobasium commented on GitHub (Jan 20, 2024): i will deploy both stacks and send you the log seperatly in 5 min
Author
Owner

@tobasium commented on GitHub (Jan 20, 2024):

only Web App + Worker

_papermerge-web-1_logs.txt

<!-- gh-comment-id:1902036044 --> @tobasium commented on GitHub (Jan 20, 2024): only Web App + Worker [_papermerge-web-1_logs.txt](https://github.com/ciur/papermerge/files/13997465/_papermerge-web-1_logs.txt)
Author
Owner

@tobasium commented on GitHub (Jan 20, 2024):

PostgreSQL compose

_papermerge-web-1_logs (1).txt

<!-- gh-comment-id:1902036872 --> @tobasium commented on GitHub (Jan 20, 2024): PostgreSQL compose [_papermerge-web-1_logs (1).txt](https://github.com/ciur/papermerge/files/13997470/_papermerge-web-1_logs.1.txt)
Author
Owner

@ciur commented on GitHub (Jan 20, 2024):

In case of last logs there is an error:

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "core_user" does not exist
LINE 2: FROM core_user 
             ^

Which means that in your case tables were not created. Could you check if db postgresql://scott:tiger@db:5432/mydatabase is accessible (i.e. you can connect to it) and it has some tables in it (e.g. core_use) ?

It is interesting, because I literally just copy paste this docker compose:

  version: "3.9"

  x-backend: &common
    image: papermerge/papermerge:3.0.1
    environment:
        PAPERMERGE__SECURITY__SECRET_KEY: 12345
        PAPERMERGE__AUTH__USERNAME: john
        PAPERMERGE__AUTH__PASSWORD: hohoho
        PAPERMERGE__DATABASE__URL: postgresql://scott:tiger@db:5432/mydatabase
        PAPERMERGE__REDIS__URL: redis://redis:6379/0
    volumes:
      - index_db:/core_app/index_db
      - media:/core_app/media
  services:
    web:
      <<: *common
      ports:
       - "12000:80"
      depends_on:
        - redis
        - db
    worker:
      <<: *common
      command: worker
    redis:
      image: redis:6
    db:
      image: bitnami/postgresql:14.4.0
      volumes:
        - postgres_data:/var/lib/postgresql/data/
      environment:
        POSTGRES_USER: scott
        POSTGRES_PASSWORD: tiger
        POSTGRES_DB: mydatabase
  volumes:
    postgres_data:
    index_db:
    media:

And then docker compose up just works (means db is created, I can authenticate with username john).

<!-- gh-comment-id:1902038969 --> @ciur commented on GitHub (Jan 20, 2024): In case of last logs there is an error: ``` sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "core_user" does not exist LINE 2: FROM core_user ^ ``` Which means that in your case tables were not created. Could you check if db `postgresql://scott:tiger@db:5432/mydatabase` is accessible (i.e. you can connect to it) and it has some tables in it (e.g. `core_use`) ? It is interesting, because I literally just copy paste this docker compose: ``` version: "3.9" x-backend: &common image: papermerge/papermerge:3.0.1 environment: PAPERMERGE__SECURITY__SECRET_KEY: 12345 PAPERMERGE__AUTH__USERNAME: john PAPERMERGE__AUTH__PASSWORD: hohoho PAPERMERGE__DATABASE__URL: postgresql://scott:tiger@db:5432/mydatabase PAPERMERGE__REDIS__URL: redis://redis:6379/0 volumes: - index_db:/core_app/index_db - media:/core_app/media services: web: <<: *common ports: - "12000:80" depends_on: - redis - db worker: <<: *common command: worker redis: image: redis:6 db: image: bitnami/postgresql:14.4.0 volumes: - postgres_data:/var/lib/postgresql/data/ environment: POSTGRES_USER: scott POSTGRES_PASSWORD: tiger POSTGRES_DB: mydatabase volumes: postgres_data: index_db: media: ``` And then `docker compose up` just works (means db is created, I can authenticate with username john).
Author
Owner

@tobasium commented on GitHub (Jan 20, 2024):

could you quickly tell me how i could test it.

here is the log from db
_papermerge-db-1_logs.txt

<!-- gh-comment-id:1902052085 --> @tobasium commented on GitHub (Jan 20, 2024): could you quickly tell me how i could test it. here is the log from db [_papermerge-db-1_logs.txt](https://github.com/ciur/papermerge/files/13997497/_papermerge-db-1_logs.txt)
Author
Owner

@ciur commented on GitHub (Jan 21, 2024):

I found the problem. The problem is that docker compose's "depends_on" waits only for the container to start, but not the service inside it; in other words "db" container may be up, while actual initialization of the postgres/mysql database is not yet ready!

I will fix that part. Thank you again for reporting the problem!

<!-- gh-comment-id:1902530152 --> @ciur commented on GitHub (Jan 21, 2024): I found the problem. The problem is that docker compose's "depends_on" waits only for the container to start, but not the service inside it; in other words "db" container may be up, while actual initialization of the postgres/mysql database is not yet ready! I will fix that part. Thank you again for reporting the problem!
Author
Owner

@ciur commented on GitHub (Jan 21, 2024):

@tobasium
I've published 3.0.2.
Also in documentation I've updated docker-compose examples to include healthcheck key - which ensures that webapp/workers will start only after database process (not just db container) is up and running. Please use update docker compose examples.

<!-- gh-comment-id:1902614851 --> @ciur commented on GitHub (Jan 21, 2024): @tobasium I've published 3.0.2. Also in documentation I've updated [docker-compose examples](https://docs.papermerge.io/3.0/setup/docker-compose/#mysql-mariadb) to include [healthcheck](https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck) key - which ensures that webapp/workers will start only after database process (not just db container) is up and running. Please use update docker compose examples.
Author
Owner

@tobasium commented on GitHub (Jan 21, 2024):

Hi, tested, and found new error: MySQL / MariaDB compose
_papermerge-web-1_logs.txt

<!-- gh-comment-id:1902695256 --> @tobasium commented on GitHub (Jan 21, 2024): Hi, tested, and found new error: MySQL / MariaDB compose [_papermerge-web-1_logs.txt](https://github.com/ciur/papermerge/files/14002088/_papermerge-web-1_logs.txt)
Author
Owner

@tobasium commented on GitHub (Jan 21, 2024):

Hi tested, Solr compose works. so that i can login into pm but solr container exits after start with following error:

Cannot write to /var/solr as 8983:8983
drwxr-xr-x 2 root root 2 Jan 21 17:02 /var/solr
Cannot write to /var/solr as 8983:8983
drwxr-xr-x 2 root root 2 Jan 21 17:02 /var/solr

<!-- gh-comment-id:1902697708 --> @tobasium commented on GitHub (Jan 21, 2024): Hi tested, Solr compose works. so that i can login into pm but solr container exits after start with following error: Cannot write to /var/solr as 8983:8983 drwxr-xr-x 2 root root 2 Jan 21 17:02 /var/solr Cannot write to /var/solr as 8983:8983 drwxr-xr-x 2 root root 2 Jan 21 17:02 /var/solr
Author
Owner

@ciur commented on GitHub (Jan 26, 2024):

I am closing the ticket as original issue was solved (original issue was that app started before db service was up, which caused "core_user table not found exception" - fixed in 3.0.2).

<!-- gh-comment-id:1911483154 --> @ciur commented on GitHub (Jan 26, 2024): I am closing the ticket as original issue was solved (original issue was that app started before db service was up, which caused "core_user table not found exception" - fixed in 3.0.2).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#454
No description provided.