Error when trying to edit settings (solution: incorrect database driver defined) #6
-
Shlink Dashboard versionlatest Shlink versionlatest How do you serve Shlink DashboardDocker image Database engineMySQL Database version10.11.11-MariaDB-0+deb12u1 - Debian 12 Current behaviorWhen in the admin user and My Settings, non of the options are changable. Like I cant turn on Dark theme, cant enable or disable any of the options. In chrome Dev tools I get the following errors:
Expected behaviorI expect to be able to change the settings Minimum steps to reproduceI simply created a stack in Portainer of both the API and the Dashboard using latest images. after getting everything working, I logged into the dashboard using admin/admin created new password. Then I went to admin at top right and selected my settings. Then tried to change settings. |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 14 replies
-
I cannot reproduce it. Can you try to reproduce it in the simplest possible scenario? A docker compose config would be ideal. |
Beta Was this translation helpful? Give feedback.
-
version: '3.8'
services:
shlink-api:
image: shlinkio/shlink:latest
container_name: shlink-api
restart: unless-stopped
environment:
- DEFAULT_DOMAIN=*****
- IS_HTTPS_ENABLED=true
- DB_DRIVER=mysql
- DB_USER=*****
- DB_PASSWORD=*****
- DB_HOST=10.0.24.101
- DB_NAME=shlink
- SHELL_VERBOSITY=3
- ENABLE_PERIODIC_VISIT_LOCATE=true
- GEOLITE_LICENSE_KEY=*****
- CORS_ALLOWED_ORIGINS=*
ports:
- "8080:8080"
volumes:
- /mnt/CONTAINER-DATA/SRV-DOCKER/shlink-api:/etc/shlink/data
shlink-dashboard:
image: shlinkio/shlink-dashboard:latest
container_name: shlink-dashboard
restart: unless-stopped
depends_on:
- shlink-api
ports:
- "8081:3005"
environment:
- SHLINK_DASHBOARD_DB_DRIVER=mysql
- SHLINK_DASHBOARD_DB_HOST=10.0.24.101
- SHLINK_DASHBOARD_DB_PORT=3306
- SHLINK_DASHBOARD_DB_NAME=shlink_dashboard
- SHLINK_DASHBOARD_DB_USER=*****
- SHLINK_DASHBOARD_DB_PASSWORD=*****
- NODE_ENV=production
volumes:
- /mnt/CONTAINER-DATA/SRV-DOCKER/shlink-dashboard:/app/data Also, just want to note that in the main areas like adding links and such all the form controls seem fine. It is only under My Settings. |
Beta Was this translation helpful? Give feedback.
-
And bear with me, please. I do work in IT, but I am very green with Docker. I would not be surprised if the problem is my end. |
Beta Was this translation helpful? Give feedback.
-
The first thing I see in that docker compose is that there's no database. Were you able to reproduce the issue consistently with that? |
Beta Was this translation helpful? Give feedback.
-
No database? there is 2, shlink_dashboard and shlink both MySQL databases. And yes, this is my compose and other than the issue described here, everything else works fine too. |
Beta Was this translation helpful? Give feedback.
-
I mean there are no database containers defined in the docker compose you provided, so it's an incomplete reproduction. The reproduction needs to be a list of steps which ends up with a running environment where the issue can be consistently reproduced. I frequently suggest providing a docker compose because it forces issue reporters to replicate a simplified version of their environment, and in the process they usually find what they did wrong. And if you don't find anything wrong, at least you are providing me with a way to reproduce the issue with just Skipping steps or making assumptions will end with me not being able to reproduce the issue, because I know how things work and therefore I'm biased. I need to see in detail what process you followed, to see what I could be missing. So long story short, your reproduction needs to include detailed information of how the database is set up, or in the case of docker compose, include database containers. |
Beta Was this translation helpful? Give feedback.
-
So it's connected to a dedicated MySQL database (mariadb) with a user and pass that has full rights to it. I simply created the databases and the containers made all the tables and data. I did go any further than create the 2 databases and the relevant user. |
Beta Was this translation helpful? Give feedback.
-
I can't reproduce the issue using your docker compose with a MySQL database. services:
db_mysql:
image: mysql:8.0.34
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: shlink_dashboard
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root --silent"]
interval: 10s
timeout: 5s
retries: 5
shlink-api:
image: shlinkio/shlink:latest
container_name: shlink-api
restart: unless-stopped
environment:
- DEFAULT_DOMAIN=localhost:8080
- IS_HTTPS_ENABLED=false
- DB_DRIVER=mysql
- DB_USER=root
- DB_PASSWORD=root
- DB_HOST=db_mysql
- DB_NAME=shlink
- SHELL_VERBOSITY=3
- INITIAL_API_KEY=foobar
ports:
- "8080:8080"
depends_on:
db_mysql:
condition: service_healthy
shlink-dashboard:
image: shlinkio/shlink-dashboard:latest
container_name: shlink-dashboard
restart: unless-stopped
ports:
- "8081:8081"
environment:
- SHLINK_DASHBOARD_DB_DRIVER=mysql
- SHLINK_DASHBOARD_DB_HOST=db_mysql
- SHLINK_DASHBOARD_DB_PORT=3306
- SHLINK_DASHBOARD_DB_NAME=shlink_dashboard
- SHLINK_DASHBOARD_DB_USER=root
- SHLINK_DASHBOARD_DB_PASSWORD=root
- NODE_ENV=production
- SHLINK_DASHBOARD_PORT=8081
depends_on:
shlink-api:
condition: service_started
db_mysql:
condition: service_healthy I also removed the volumes, as you shouldn't need that, but I doubt that is the reason. I'm going to need more precise information of your environment. What is the exact database version you are using (you mention MySQL, but then on the version it says MariaBD, so which one is it?) I also need the exact sequence of steps you followed since the first log in with the initial admin user, until you experienced the issue for the first time. Also, how did you notice the settings were not getting saved. Is it reflected in the UI clearly? Is there some error? Is it siply "unresponsive" and only the console error exists? Regarding the |
Beta Was this translation helpful? Give feedback.
-
And everything works with MariaDB 10.11 as well: services:
db_mysql:
- image: mysql:8.0.34
+ image: mariadb:10.11
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: shlink_dashboard
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root --silent"]
interval: 10s
timeout: 5s
retries: 5
shlink-api:
image: shlinkio/shlink:latest
container_name: shlink-api
restart: unless-stopped
environment:
- DEFAULT_DOMAIN=localhost:8080
- IS_HTTPS_ENABLED=false
- - DB_DRIVER=mysql
+ - DB_DRIVER=maria
- DB_USER=root
- DB_PASSWORD=root
- DB_HOST=db_mysql
- DB_NAME=shlink
- SHELL_VERBOSITY=3
- INITIAL_API_KEY=foobar
ports:
- "8080:8080"
depends_on:
db_mysql:
condition: service_healthy
shlink-dashboard:
image: shlinkio/shlink-dashboard:latest
container_name: shlink-dashboard
restart: unless-stopped
ports:
- "8081:8081"
environment:
- - SHLINK_DASHBOARD_DB_DRIVER=mysql
+ - SHLINK_DASHBOARD_DB_DRIVER=mariadb
- SHLINK_DASHBOARD_DB_HOST=db_mysql
- SHLINK_DASHBOARD_DB_PORT=3306
- SHLINK_DASHBOARD_DB_NAME=shlink_dashboard
- SHLINK_DASHBOARD_DB_USER=root
- SHLINK_DASHBOARD_DB_PASSWORD=root
- NODE_ENV=production
- SHLINK_DASHBOARD_PORT=8081
depends_on:
shlink-api:
condition: service_started
db_mysql:
condition: service_healthy |
Beta Was this translation helpful? Give feedback.
-
I have MariaDB version 10.11.11 Steps were creating a template in Portainer with the code I shared. Then I create a Stack using this template. Once running, I created the password for new login, logged in and immediately when to My Settings in top right under Username. There, I cannot edit any of the settings. Like not only not saving, I can't actually change any of the form elements. Such as I cannot select dark mode, the button doesn't change, and it doesn't go into dark mode. In looking over your compose code, I noticed you have DB_DRIVER=maria and SHLINK_DASHBOARD_DB_DRIVER=mariadb Is this correct? or shuld they both be mariadb or both maria? Could this be the problem I have as I noticed I have mysql in my compose. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's correct. It's an inconsistency I just found out between Shlink and Shlink Dashboard. I plan to normalize this soon, but for now they expect slightly different values.
Yes, that can definitely be a problem, as the service will be using the wrong driver. Make sure you indicate the proper driver and try again. Settings are saved in the database, so providing the wrong configuration could make some database operations fail. In the case of MySQL and MariaDB, some may still work due to their similarities. If this is the case, the settings might have been a red herring, and the problem was in fact the database configuration all the time. Did you try any other DB-related operation other than changing the settings? Like creating users or servers. |
Beta Was this translation helpful? Give feedback.
-
i have now changed them. For the first time I have been able to change, at least the dark mode now, though it takes along time, it seems very very slow. Could this be data in the database? Is it a good idea for me to empty the dashboard database and start fresh, and will this loose me my current shortlinks? |
Beta Was this translation helpful? Give feedback.
-
So, I just backed up the dashboard database just in case. I deleted all tables in the used database and restarted the containers. I reset up my user account, and also re added my api server. All came back, stats and all. Now, I seem to have no issues at all. Everything seems to work now, and fast too. Thankyou so much for the help and guidance. It was my fault, actually its the first time I have ever had to specifically specify MariaDB, must have been lucky until now. In the future will check for MariaDB vs MySQL code from now on. Thanks again for the help. Much appreciated. Oh, and this is a wonderful product too. |
Beta Was this translation helpful? Give feedback.
-
I'm glad to know that everything was sorted out. |
Beta Was this translation helpful? Give feedback.
Yes, that's correct. It's an inconsistency I just found out between Shlink and Shlink Dashboard. I plan to normalize this soon, but for now they expect slightly different values.
Yes, that can definitely be a problem, as the service will be using the wrong driver. Make sure you indicate the proper driver and try again.
Settings are saved in the database, so providing the wrong configuration could make some database operations fail. In the case of MySQL and MariaDB, some may still work due to their similarities.
If this is the case, the settings might …