Skip to content

fix: avoid database connection during setup by using native exec#3624

Open
horsley wants to merge 1 commit intoDokploy:canaryfrom
horsley:fix/setup-import-side-effect
Open

fix: avoid database connection during setup by using native exec#3624
horsley wants to merge 1 commit intoDokploy:canaryfrom
horsley:fix/setup-import-side-effect

Conversation

@horsley
Copy link

@horsley horsley commented Feb 7, 2026

The setup.ts script imports execAsync from @dokploy/server, which triggers the entire package to load including lib/auth.ts. This module initializes betterAuth() with a database connection at import time, causing the setup script to fail with ECONNREFUSED before the database container is created.

This fix replaces the import with Node.js native promisify(exec), avoiding the module side-effect that attempts database connection during setup.

What is this PR about?

Running pnpm run dokploy:setup fails with ECONNREFUSED error when the PostgreSQL database container doesn't exist yet. This is a chicken-and-egg problem: the setup script is supposed to create the database, but it fails before creating it because it tries to connect to the database during module import.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

closes #2241

Screenshots (if applicable)

The setup.ts script imports execAsync from @dokploy/server, which triggers
the entire package to load including lib/auth.ts. This module initializes
betterAuth() with a database connection at import time, causing the setup
script to fail with ECONNREFUSED before the database container is created.

This fix replaces the import with Node.js native promisify(exec), avoiding
the module side-effect that attempts database connection during setup.
@horsley horsley requested a review from Siumauricio as a code owner February 7, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot start pnpm run dokploy:setup

1 participant