Skip to content

CLI doesnt connect to the database via --db-url #903

@vacavaca

Description

@vacavaca

Bug report

Describe the bug

I'm running a self-hosted version of supabase. My postgres container exposes its port at 127.0.0.1:5433 but the CLI throws a "connection refused" error when I'm trying to generate types.

To Reproduce

supabase gen types typescript --debug --db-url postgresql://postgres:12345@127.0.0.1:5433/postgres --schema public > database.types.ts

# ...
Error: connect ECONNREFUSED 127.0.0.1:5433
    at file:///usr/src/app/dist/server/app.js:67:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
# ...

To verify the postgres instance is reachable:

docker run --rm -it --network host postgres psql --host 127.0.0.1 -p 5433 -U postgre

Password for user postgres:
psql (15.1 (Debian 15.1-1.pgdg110+1), server 14.6 (Debian 14.6-1.pgdg110+1))
Type "help" for help.

postgres=> \dt
             List of relations
 Schema |  Name   | Type  |     Owner
--------+---------+-------+----------------
 public | profile | table | supabase_admin
 public | role    | table | supabase_admin
(2 rows)

postgres=>

Expected behavior

CLI connects to the database and generates types

System information

  • OS: macOS Ventura 13.1
  • Version of supabase-js: 1.41.1
  • Version of Node.js: 18.14.1

I suspect the problem is related to docker networking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions