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

Issue: ECONNREFUSED Error with Supabase and Drizzle ORM During Migration #5

Open
abhishek9773 opened this issue Aug 7, 2024 · 0 comments

Comments

@abhishek9773
Copy link
Owner

Description:
When attempting to run the database migration script using Drizzle ORM with Supabase, an ECONNREFUSED error is encountered. This issue occurs when executing the migration command npm run db:run, resulting in the inability to connect to the database.

Error Message:

abhishek@server1:~/Documents/github/web_developement/next/farmhub$ npm run db:run

> farmhub@0.1.0 db:run
> node -r esbuild-register ./migrate.ts

undefined
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: connect ECONNREFUSED 127.0.0.1:5432
    at __node_internal_captureLargerStackTrace (node:internal/errors:497:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:672:12)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432
}

Node.js v20.9.0

Steps to Reproduce:

  1. Run npm run db:run in the project directory.
  2. Observe the error message indicating a connection refusal to 127.0.0.1:5432.

Expected Behavior:
The migration script should execute successfully and connect to the Supabase database, applying any pending migrations.

Actual Behavior:
The script fails with an ECONNREFUSED error, indicating that the connection to 127.0.0.1 on port 5432 is being refused.

Environment:

  • Node.js Version: v20.9.0
  • Database: Supabase (PostgreSQL)
  • ORM: Drizzle ORM
  • Migration Script:

Potential Error-Causing Files:

  • migrate.ts
  • drizzle.config.ts
  • lib/db/db.ts
@abhishek9773 abhishek9773 pinned this issue Aug 7, 2024
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

No branches or pull requests

1 participant