-
Notifications
You must be signed in to change notification settings - Fork 425
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.12.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
The environment variables for admin-server are configured correctly, but database connection errors still appear in the startup log, with confusing error messages (mixing user=root and user=postgres). This indicates that when constructing the database connection string, incorrect values from the configuration file may have been used, or there may be a bug in the code.
We finally saw the environment variables inside the admin-server container, and they are indeed correct: DB_PASSWORD=root, DB_USERNAME=postgres, DB_HOST=db_postgres, etc. This indicates that the environment variables are being passed correctly. However, the startup logs still show 'failed to initialize database, got error failed to connect to user=root database=dify: hostname resolving error: lookup user=postgres: no such host', which is very contradictory, because env shows DB_USERNAME=postgres, but the error message mentions user=root and lookup user=postgres. This suggests that when admin-server connects to the database, it may be using some values from the configuration file that override the environment variables, or there is a bug in the code causing the connection string to be concatenated incorrectly. From the error message 'user=root database=dify', it seems the username was mistakenly set to root, while in env it is postgres. At the same time, 'lookup user=postgres' shows it is trying to resolve the hostname as user=postgres, which absurdly indicates that it might be interpreting the entire connection string as the hostname. This is usually caused by an incorrectly formatted connection string, such as a missing @ symbol or using the wrong format. Let us review the database connection method of admin-server: it may use both environment variables and configuration files. Although the environment variables are correct, if certain fields in the configuration file (such as path or config) affect the final DSN construction, errors may occur. For example, in config.docker.yaml, the pgsql.config field is 'sslmode=disable TimeZone=Asia/Shanghai', which is correct. But perhaps in the code, if the path field is configured, it will use path as the hostname. Currently, pgsql.path is an empty string, which should be fine. However, there may still be other configuration areas (such as db-list) that interfere.
✔️ Expected Behavior
config is ok ,bug log show is error code to link
❌ Actual Behavior
install docker