Error Environment PGUSER for PG/PGVECTOR/PGVECTO-RS in docker-compose file #11997

Closed
opened 2026-02-21 19:05:11 -05:00 by yindo · 2 comments
Owner

Originally created by @za-zliea on GitHub (Mar 23, 2025).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Error Fix

environment PGUSER for PG/PGVECTOR/PGVECTO-RS in docker-compose should be POSTGRES_USER

Full Doc
https://hub.docker.com/_/postgres

Steps to reproduce

After change DB_USERNAME value in .env file, then run docker compose up, dify-plugin_daemon-1 container cannot start.

Image

✔️ Expected Behavior

dify run success

Actual Behavior

dify-plugin_daemon-1 container error log

Image

:

2025/03/23 05:25:51 /app/internal/db/init.go:17
[error] failed to initialize database, got error failed to connect to `host=db user=dify database=dify_plugin`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))

2025/03/23 05:25:51 /app/internal/db/init.go:21
[error] failed to initialize database, got error failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))
2025/03/23 05:25:51 init.go:144: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))
panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))%!(EXTRA *pgconn.ConnectError=failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01)))

goroutine 1 [running]:
github.com/langgenius/dify-plugin-daemon/internal/utils/log.writeLog({0x16d5294, 0x5}, {0x170423d?, 0x7?}, 0x1, {0xc00063fd00, 0x1, 0x1})
        /app/internal/utils/log/log.go:40 +0x326
github.com/langgenius/dify-plugin-daemon/internal/utils/log.Panic(...)
        /app/internal/utils/log/log.go:66
github.com/langgenius/dify-plugin-daemon/internal/db.Init(0x2710?)
        /app/internal/db/init.go:144 +0xde
github.com/langgenius/dify-plugin-daemon/internal/server.(*App).Run(0xc0000b60d8, 0xc0004ac708)
        /app/internal/server/server.go:67 +0xd2
main.main()
        /app/cmd/server/main.go:28 +0xff
Originally created by @za-zliea on GitHub (Mar 23, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ### Error Fix environment **PGUSER** for PG/PGVECTOR/PGVECTO-RS in docker-compose should be **POSTGRES_USER** Full Doc https://hub.docker.com/_/postgres ### Steps to reproduce After change **DB_USERNAME** value in .env file, then run `docker compose up`, `dify-plugin_daemon-1` container cannot start. <img width="891" alt="Image" src="https://github.com/user-attachments/assets/f10eeb92-a0d7-4f89-b8dc-5e7166723e7e" /> ### ✔️ Expected Behavior dify run success ### ❌ Actual Behavior `dify-plugin_daemon-1` container error log <img width="891" alt="Image" src="https://github.com/user-attachments/assets/ea32896f-8145-49b5-96cb-1c113a451af1" /> : ``` 2025/03/23 05:25:51 /app/internal/db/init.go:17 [error] failed to initialize database, got error failed to connect to `host=db user=dify database=dify_plugin`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01)) 2025/03/23 05:25:51 /app/internal/db/init.go:21 [error] failed to initialize database, got error failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01)) 2025/03/23 05:25:51 init.go:144: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01)) panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))%!(EXTRA *pgconn.ConnectError=failed to connect to `host=db user=dify database=postgres`: failed SASL auth (FATAL: password authentication failed for user "dify" (SQLSTATE 28P01))) goroutine 1 [running]: github.com/langgenius/dify-plugin-daemon/internal/utils/log.writeLog({0x16d5294, 0x5}, {0x170423d?, 0x7?}, 0x1, {0xc00063fd00, 0x1, 0x1}) /app/internal/utils/log/log.go:40 +0x326 github.com/langgenius/dify-plugin-daemon/internal/utils/log.Panic(...) /app/internal/utils/log/log.go:66 github.com/langgenius/dify-plugin-daemon/internal/db.Init(0x2710?) /app/internal/db/init.go:144 +0xde github.com/langgenius/dify-plugin-daemon/internal/server.(*App).Run(0xc0000b60d8, 0xc0004ac708) /app/internal/server/server.go:67 +0xd2 main.main() /app/cmd/server/main.go:28 +0xff ```
yindo added the 🐞 bug label 2026-02-21 19:05:11 -05:00
yindo closed this issue 2026-02-21 19:05:11 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 23, 2025):

Hey @za-zliea! I'm here to assist you with any bugs, questions, or contributions you have for the project. Let's tackle this issue together!

It seems like the issue you're encountering is related to the environment variable PGUSER being incorrectly set in the docker-compose file for the PG/PGVECTOR/PGVECTO-RS services. The correct environment variable to use is POSTGRES_USER, as per the documentation for PostgreSQL.

The error logs indicate a failure in password authentication for the user "dify". This suggests that the username or password might be incorrect or not properly set in your environment variables.

To resolve this issue, ensure that:

  1. The POSTGRES_USER environment variable is correctly set in your docker-compose file and matches the username you intend to use.
  2. The POSTGRES_PASSWORD is also correctly set to match the password for the specified user.
  3. Verify that these changes are reflected in your .env file and that the docker-compose setup is using the updated values.

After making these changes, try running docker compose up again to see if the issue is resolved.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 23, 2025): <!-- Greeting --> Hey @za-zliea! I'm here to assist you with any bugs, questions, or contributions you have for the project. Let's tackle this issue together! <!-- Answer --> It seems like the issue you're encountering is related to the environment variable `PGUSER` being incorrectly set in the docker-compose file for the `PG/PGVECTOR/PGVECTO-RS` services. The correct environment variable to use is `POSTGRES_USER`, as per the documentation for PostgreSQL. The error logs indicate a failure in password authentication for the user "dify". This suggests that the username or password might be incorrect or not properly set in your environment variables. To resolve this issue, ensure that: 1. The `POSTGRES_USER` environment variable is correctly set in your docker-compose file and matches the username you intend to use. 2. The `POSTGRES_PASSWORD` is also correctly set to match the password for the specified user. 3. Verify that these changes are reflected in your `.env` file and that the `docker-compose` setup is using the updated values. After making these changes, try running `docker compose up` again to see if the issue is resolved. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/feda97ed-ef63-4217-8a93-ca04860c7df0?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jun 22, 2025):

fix: remove redundant PG_USER (#21162)

@crazywoola commented on GitHub (Jun 22, 2025): fix: remove redundant PG_USER (#21162)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11997