Skip to content

Failed to initialize database, got error failed to connect to host=xxxxx user=xxxxx database=postgres #28

Open
@ivannguyendev

Description

When trying to connect to PostgreSQL cloud, encountering authentication error:

[error] failed to initialize database, got error failed to connect to 
`host=xxxxx user=xxxxx database=postgres`: server error 
(FATAL: no pg_hba.conf entry for host "xxxxxx", user "xxxxx", database "postgres", no encryption (SQLSTATE 28000))

Configuration

environment configuration in dify-plugin.yaml:

- name: DB_USERNAME
  valueFrom:
    secretKeyRef:
      name: postgres-credentials
      key: pg-username
- name: DB_PASSWORD
  valueFrom:
    secretKeyRef:
      name: postgres-credentials
      key: pg-password
- name: DB_HOST
  valueFrom:
    secretKeyRef:
      name: postgres-credentials
      key: pg-host
- name: DB_PORT
  valueFrom:
    secretKeyRef:
      name: postgres-credentials
      key: pg-port
- name: DB_DATABASE
  value: dify-plugin
- name: SQLALCHEMY_POOL_SIZE
  value: '20'
- name: DB_PLUGIN_DATABASE
  value: dify-plugin

i find a hardcoded 'postgres' database name here: https://github.com/langgenius/dify-plugin-daemon/blob/main/internal/db/init.go

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions