Error using Vikunja in Portainer

Hello,

this is my first post so I want to thank the vikunja ppl and the community for this terrific tool :slight_smile:

I had Vikunja running for some weeks in my local network only with no problems. Then I decided to make it available from outside using my Domain, SSL and nginx proxy manager using portainer but ran into some strange behaviour making it impossible to use vikunja.

The Symtoms:

  • The Loginpage wasn´t reachable using the Domain. I had to use the IP of my host system to create my user. Error: API wasn´t reachable. Althoug I´m gettin a response from https://myDomain.tld/api/v1
  • Sometimes my Tasks dont show up and it shows a “Internal Server Error” in the left bottom corner of the screen. After refreshing the page… everythings loads fine.
  • I´m getting this error 500 in my API logs from time to time (maybe 50% of connections)

2023-10-02T08:50:06.290581029Z: ERROR	▶ handler/ReadAllWeb 1812 Error 1698 (28000): Access denied for user 'vikunja'@'172.24.0.9'

Pinging the DB from API Container is possible without any errors and I can´t see any container beeing unstable or rebooting…

Here is my docker-compose.yaml…

version: '3'

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: SOMEPASSWORD
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: SOMEPASSWORD
      MYSQL_DATABASE: vikunja
    volumes:
      - /home/manu/volumes/vikunja/db:/var/lib/mysql
    restart: unless-stopped
    networks:
      - nginxproxymanager_default
  api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: SOMEPASSWORD
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: SOMEPASSWORD
      VIKUNJA_SERVICE_FRONTENDURL: https://todos.mydomain.de/
    volumes: 
      - /home/manu/volumes/vikunja/files:/app/vikunja/files
    depends_on:
      - db
    restart: unless-stopped
    networks:
      - nginxproxymanager_default
  frontend:
    image: vikunja/frontend
    restart: unless-stopped
    networks:
      - nginxproxymanager_default
  proxy:
    image: nginx
    ports:
      - 8081:80
    volumes:
      - /home/manu/volumes/vikunja/nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - api
      - frontend
    restart: unless-stopped
    networks:
      - nginxproxymanager_default
networks:
  nginxproxymanager_default:
    name: nginxproxymanager_default
    external: true

Here is some more info on my network: (docker ps)

CONTAINER ID   IMAGE                                  COMMAND                  CREATED          STATUS          PORTS                                                                                                             NAMES
893d8fb1a340   nginx                                  "/docker-entrypoint.…"   57 minutes ago   Up 57 minutes   0.0.0.0:8081->80/tcp, :::8081->80/tcp                                                                             vikunja-proxy-1
b617da98b978   vikunja/api                            "/sbin/tini -g -- /e…"   57 minutes ago   Up 57 minutes   3456/tcp                                                                                                          vikunja-api-1
f6387b9d94cb   mariadb:10                             "docker-entrypoint.s…"   57 minutes ago   Up 57 minutes   3306/tcp                                                                                                          vikunja-db-1
d5f27eca07c1   vikunja/frontend                       "/docker-entrypoint.…"   57 minutes ago   Up 57 minutes   80/tcp                                                                                                            vikunja-frontend-1
adb2b4aa9c4d   nextcloud                              "/entrypoint.sh apac…"   2 hours ago      Up 2 hours      0.0.0.0:8084->80/tcp, :::8084->80/tcp                                                                             nextcloud
bdcf8636481b   mariadb                                "docker-entrypoint.s…"   2 hours ago      Up 2 hours      3306/tcp                                                                                                          maria-db
5280a1b77548   lscr.io/linuxserver/duplicati:latest   "/init"                  20 hours ago     Up 20 hours     0.0.0.0:8082->8200/tcp, :::8082->8200/tcp                                                                         duplicati
b79b2b68a530   jc21/nginx-proxy-manager:latest        "/init"                  24 hours ago     Up 23 hours     0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:8080->81/tcp, :::8080->81/tcp   nginxproxymanager-app-1
b63442530005   jc21/mariadb-aria:latest               "/scripts/run.sh"        24 hours ago     Up 23 hours     3306/tcp                                                                                                          nginxproxymanager-db-1
fd19786dbf3a   portainer/portainer-ce:latest          "/portainer"             5 days ago       Up 23 hours     0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp                    portainer

Thank you!

Did you expose the api and frontend?

Did you set up cors so that it is reachable via the domain?

Which response? Any errors in the logs?

Hello,

when I visit https://myDomain.tld/api/v1 in the browser, im getting this response:
{"message":"missing or malformed jwt"}

I did not set up CORS but vikunja is handling 50% of the requests fine, so I didn´t think it could be a CORS problem. I´ll give it a try anyway.

Thank you!

When i log in, sometimes my Projects are not showing up, but after hitting F5 for a couple of times the projects and tasks are suddenly loading.

This is the error in the API-Log:

2023-10-03T12:00:26.576951672Z: ERROR	▶ handler/ReadAllWeb 5a20 Error 1045 (28000): Access denied for user 'vikunja'@'172.24.0.9' (using password: YES)

Looks like the API sometimes cant access the DB. But I cant see why…

It looks like CORS is enabled by default.

hmm, I just tried to access vikunja using the local IP of my host and I´m getting the same errors. Looks like some DB problem to me.

ok, I switched to sqlite. Everything works fine now… Problem solved :slight_smile: