Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The PostgresDatabaseAdapter within initializeDatabase does not handle SSL correctly #1583

Open
JoseRoberts87 opened this issue Dec 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@JoseRoberts87
Copy link

Is your feature request related to a problem? Please describe.

When trying to connect to an RDS postgres instance, the connection request failed because it Error: Failed to connect to database which was resolved by adding ssl: { rejectUnauthorized: false } to the PostgresDatabaseAdapter

Describe the solution you'd like

To manage both local and remote postgres db connections, we can add the following:
ssl: process.env.POSTGRES_URL.includes("localhost") ? undefined : { rejectUnauthorized: false }
this will allow for a local host instance or a remote instance connection string

    if (process.env.POSTGRES_URL) {
        elizaLogger.info("Initializing PostgreSQL connection...");
        const db = new PostgresDatabaseAdapter({
            connectionString: process.env.POSTGRES_URL,
            parseInputs: true,
            ssl: process.env.POSTGRES_URL.includes("localhost")
                ? undefined
                : { rejectUnauthorized: false },
        });```

**Describe alternatives you've considered**

i tried adding the SSL flag to the connection string without great success

**Additional context**

Open to suggestions on alternate implementations that achieve the same
@JoseRoberts87 JoseRoberts87 added the enhancement New feature or request label Dec 30, 2024
Copy link

Hello @JoseRoberts87! Welcome to the ai16z community. Thank you for opening your first issue; we appreciate your contribution. You are now a ai16z contributor!

@dgogiaa
Copy link

dgogiaa commented Dec 31, 2024

uf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants