supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 201 forks source link

Error with diff `'Session' object has no attribute 'engine'` #953

Closed amr3k closed 1 year ago

amr3k commented 1 year ago

Bug report

Describe the bug

I've not being able to use supabase db diff --use-migra for some time now. Here's my output:

❯ supabase db diff --use-migra
Connecting to local database...
Creating shadow database...
Applying migration 20230126132152_remote_commit.sql...
Applying migration 20230129165002_room_details.sql...
Applying migration 20230129165313_bill.sql...
Applying migration 20230209135221_foreign_key_refactor.sql...
Applying migration 20230211221504_departure_description.sql...
Applying migration 20230211222015_departure_time.sql...
Applying migration 20230211224341_departure_day.sql...
Applying migration 20230211224908_departure_stop.sql...
Applying migration 20230211225343_arrival_stop.sql...
Applying migration 20230211225944_bus_capacity.sql...
Applying migration 20230211230437_admin_id.sql...
Applying migration 20230211230712_created_at.sql...
Applying migration 20230211232100_discounts_table_rename.sql...
Applying migration 20230211234820_trips_table_rename.sql...
Applying migration 20230212030923_reservations_table_snake_case.sql...
Applying migration 20230213015544_departure_day_number.sql...
Applying migration 20230214120043_settings_table.sql...
Applying migration 20230216044935_everything_is_nullable.sql...
Applying migration 20230216112215_repeating_trips_admin.sql...
Applying migration 20230216142213_function_snake_case.sql...
Applying migration 20230217053323_settings_updated_by.sql...
Applying migration 20230218100222_generated_updated_default.sql...
Applying migration 20230219042902_reservations_table_metadata.sql...
Applying migration 20230223095950_remote_commit.sql...
Applying migration 20230226100648_db_trigger_before_delete.sql...
Applying migration 20230226101002_deleted_db_trigger_after_delete.sql...
Applying migration 20230306192629_reservations_nationality.sql...
Diffing schemas: auth,extensions,public,storage
Error: error diffing schema: error running container: exit 1:
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.1.1; however, version 23.0.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/schemainspect/misc.py", line 9, in connection_from_s_or_c
    s_or_c.engine
AttributeError: 'Session' object has no attribute 'engine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3212, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 301, in connect
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 761, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 419, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 142, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 247, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in __init__
    self.__connect()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 605, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 599, in __connect
    connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 584, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "localhost" to address: Name does not resolve

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/migra", line 8, in <module>
    sys.exit(do_command())
  File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 121, in do_command
    status = run(args)
  File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 86, in run
    m = Migration(
  File "/usr/local/lib/python3.9/site-packages/migra/migra.py", line 31, in __init__
    self.changes.i_from = get_inspector(
  File "/usr/local/lib/python3.9/site-packages/schemainspect/get.py", line 14, in get_inspector
    c = connection_from_s_or_c(x)
  File "/usr/local/lib/python3.9/site-packages/schemainspect/misc.py", line 14, in connection_from_s_or_c
    return s_or_c.connection()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1516, in connection
    return self._connection_for_bind(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1526, in _connection_for_bind
    return self._transaction._connection_for_bind(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 747, in _connection_for_bind
    conn = bind.connect()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3166, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
    else engine.raw_connection()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3245, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3215, in _wrap_pool_connect
    Connection._handle_dbapi_exception_noconnection(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2068, in _handle_dbapi_exception_noconnection
    util.raise_(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3212, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 301, in connect
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 761, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 419, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 142, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 247, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in __init__
    self.__connect()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 605, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 599, in __connect
    connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 584, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "localhost" to address: Name does not resolve

(Background on this error at: http://sqlalche.me/e/14/e3q8)

Try rerunning the command with --debug to troubleshoot the error.

To Reproduce

  1. Run supabase db diff --use-migra
  2. See the error

Expected behavior

Should output the diff.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

Additional context

I stopped all containers, removed them, deleted all docker images, disabled ufw, rebooted my PC, removed supabase cli, started all over again with supabase start it downloaded images, setup everything... but the issue still here.

Please note that the API, database and everything works normally, but not the diff tool.

sweatybridge commented 1 year ago

Hi, thanks for the detailed report. Could you help me run the following since I don't have an arch linux system to test

docker container inspect <supabase_differ_container_id>

The differ container should be up briefly when the diff command is run so you would need to inspect it before it goes down. I'm interested in its network settings state as this isn't the expected behaviour of host network.

Could you also double check the reported docker version? Many users reported success with 20.10 but it's the first time I'm seeing 23.0

amr3k commented 1 year ago

Hi @sweatybridge , I don't know the differ container, I ran this command to list all running containers, can you please point which one you were asking for?

❯ docker ps -a
CONTAINER ID   IMAGE                                             COMMAND                  CREATED      STATUS                 PORTS                                                                                                                                   NAMES
86bcd24d8e65   public.ecr.aws/supabase/studio:20230216-e731b77   "docker-entrypoint.s…"   2 days ago   Up 7 hours (healthy)   0.0.0.0:54323->3000/tcp, :::54323->3000/tcp                                                                                             supabase_studio_website
54476139be48   public.ecr.aws/supabase/postgres-meta:v0.60.7     "docker-entrypoint.s…"   2 days ago   Up 7 hours (healthy)   8080/tcp                                                                                                                                supabase_pg_meta_website
de65ae5da4db   public.ecr.aws/supabase/imgproxy:v3.8.0           "imgproxy"               2 days ago   Up 7 hours (healthy)   8080/tcp                                                                                                                                storage_imgproxy_website
1a21328406ea   public.ecr.aws/supabase/storage-api:v0.29.1       "docker-entrypoint.s…"   2 days ago   Up 7 hours (healthy)   5000/tcp                                                                                                                                supabase_storage_website
781baf83cfec   public.ecr.aws/supabase/postgrest:v10.1.2         "/bin/postgrest"         2 days ago   Up 7 hours             3000/tcp                                                                                                                                supabase_rest_website
e62cd608fcaf   public.ecr.aws/supabase/realtime:v2.6.0           "/usr/bin/tini -s -g…"   2 days ago   Up 7 hours (healthy)                                                                                                                                           realtime-dev.supabase_realtime_website
c24a084429e0   public.ecr.aws/supabase/inbucket:3.0.3            "/start-inbucket.sh …"   2 days ago   Up 7 hours (healthy)   0.0.0.0:54326->1100/tcp, :::54326->1100/tcp, 0.0.0.0:54325->2500/tcp, :::54325->2500/tcp, 0.0.0.0:54324->9000/tcp, :::54324->9000/tcp   supabase_inbucket_website
ac3c49019056   public.ecr.aws/supabase/gotrue:v2.51.4            "gotrue"                 2 days ago   Up 7 hours (healthy)                                                                                                                                           supabase_auth_website
2ebeccd7912a   public.ecr.aws/supabase/kong:2.8.1                "sh -c 'cat <<'EOF' …"   2 days ago   Up 7 hours (healthy)   8001/tcp, 8443-8444/tcp, 0.0.0.0:54321->8000/tcp, :::54321->8000/tcp                                                                    supabase_kong_website
fecbb446926c   public.ecr.aws/supabase/postgres:15.1.0.54-rc0    "docker-entrypoint.s…"   2 days ago   Up 7 hours (healthy)   0.0.0.0:54322->5432/tcp, :::54322->5432/tcp                                                                                             supabase_db_website
sweatybridge commented 1 year ago

Sorry let me clarify. The differ container is only spin up temporarily and looks like this

CONTAINER ID   IMAGE                                                          COMMAND                  CREATED                  STATUS                         PORTS                     NAMES
eb85dbd8bdc6   public.ecr.aws/supabase/migra:3.0.1621480950                   "/docker-entrypoint.…"   Less than a second ago   Up Less than a second                                    crazy_ramanujan

You can try to capture it by starting supabase db diff & in background, then inspect the last started container

docker container inspect $(docker ps -l --format '{{.ID}}')

Run it a few times and you should see some output for the differ container like this

            "Image": "public.ecr.aws/supabase/migra:3.0.1621480950",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.project": "cli",
                "com.supabase.cli.project": "cli"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "5f71921b20a281af66bf2e1f057497909c96a5a2b982e8b7b928f7b29605aa9b",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/default",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "318aa1b5039ab00bfa37cf25dae1a09c799b8ae30b906f3c263c2aac1fe1586d",
                    "EndpointID": "793034aadc3643d8fc1c30270bcdd602371d545816614b6dacdfdb02c93ce580",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
amr3k commented 1 year ago

Ran supabase db diff --use-migra in a terminal, and ran this command in a separate terminal window, and here's the result..

❯ docker container inspect $(docker ps -l --format '{{.ID}}')
[
    {
        "Id": "51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff",
        "Created": "2023-03-22T14:49:35.275495069Z",
        "Path": "/docker-entrypoint.sh",
        "Args": [
            "/bin/sh",
            "-c",
            "set -- auth extensions public storage;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] && set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 1950123,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-03-22T14:49:35.700519245Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:e2d4ea346dccdef2959a01c8e38edb0582c7a1b25ffc2d849ec8b56ab83bc1e7",
        "ResolvConfPath": "/var/lib/docker/containers/51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff/hostname",
        "HostsPath": "/var/lib/docker/containers/51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff/hosts",
        "LogPath": "/var/lib/docker/containers/51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff/51a07524ce6a1dcb92e224ff306b870a6350fc82a585bf4b881bfdc02d370dff-json.log",
        "Name": "/angry_pasteur",
        "RestartCount": 0,
        "Driver": "btrfs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "host",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": null,
            "Name": "btrfs"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "APC",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "SOURCE=postgresql://postgres:postgres@localhost:54320/postgres",
                "TARGET=postgresql://postgres:postgres@localhost:54322/postgres?connect_timeout=10",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
                "PYTHON_VERSION=3.9.5",
                "PYTHON_PIP_VERSION=21.1.1",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "set -- auth extensions public storage;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] && set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
            ],
            "Image": "public.ecr.aws/supabase/migra:3.0.1621480950",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.project": "website",
                "com.supabase.cli.project": "website"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "1e9e5b51a756279566c631d35a166bf046550c90252f68a83920323a02a3ca58",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/default",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "b152ad5d6683e05c20ba584c888c355b84831d553805fdbfd2b58b644bd33053",
                    "EndpointID": "d735d6f61f55636d011ca98694fe76a97a9c19ab2a3534ec14c1e589dba7ff11",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]
amr3k commented 1 year ago

Ok, found a workaround thanks to chatGPT :)

❯ docker container inspect `docker ps -a|rg migra|cut -d ' ' -f1`
Found existing alias for "docker container inspect". You should use: "dcin"
[
    {
        "Id": "0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd",
        "Created": "2023-03-22T15:02:21.704294313Z",
        "Path": "/docker-entrypoint.sh",
        "Args": [
            "/bin/sh",
            "-c",
            "set -- auth extensions public storage;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] && set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 2014316,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-03-22T15:02:22.126363011Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:e2d4ea346dccdef2959a01c8e38edb0582c7a1b25ffc2d849ec8b56ab83bc1e7",
        "ResolvConfPath": "/var/lib/docker/containers/0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd/hostname",
        "HostsPath": "/var/lib/docker/containers/0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd/hosts",
        "LogPath": "/var/lib/docker/containers/0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd/0d34f952630f7186f66de182ef50d50e4992aa9e8679a804c93946d1797d8bdd-json.log",
        "Name": "/blissful_volhard",
        "RestartCount": 0,
        "Driver": "btrfs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "host",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": null,
            "Name": "btrfs"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "APC",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "SOURCE=postgresql://postgres:postgres@localhost:54320/postgres",
                "TARGET=postgresql://postgres:postgres@localhost:54322/postgres?connect_timeout=10",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
                "PYTHON_VERSION=3.9.5",
                "PYTHON_PIP_VERSION=21.1.1",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "set -- auth extensions public storage;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] && set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
            ],
            "Image": "public.ecr.aws/supabase/migra:3.0.1621480950",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.project": "website",
                "com.supabase.cli.project": "website"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "6388e4b0c9a9f401257cce1e9c5ecaf7e444418d5e8a3381d83d0b5cd24e7bce",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/default",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "b152ad5d6683e05c20ba584c888c355b84831d553805fdbfd2b58b644bd33053",
                    "EndpointID": "e02950f2f46681faca43b2faaadb2f0f14b13f86c42967c909fcbe5592993fad",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]
sweatybridge commented 1 year ago

Thanks again for the logs.

One difference I see in your config is "Hostname": "APC" whereas on my machine it's "Hostname": "docker-desktop".

Are you using docker desktop or just docker engine? Perhaps there are some differences in the way host network is setup between the two. Could you try installing docker desktop for arch?

amr3k commented 1 year ago

I'm using docker from the terminal, also help to mention that the diff was working well until some time ago, I don't use docker for anything. only supabase cli is using docker on my machine.

amr3k commented 1 year ago

Here are the networks:

❯ docker network ls
NETWORK ID     NAME                       DRIVER    SCOPE
ab6c36cc078b   bridge                     bridge    local
b152ad5d6683   host                       host      local
e286b18c0ffd   none                       null      local
72cfcf38a672   supabase_network_website   bridge    local
sweatybridge commented 1 year ago

I'm using docker from the terminal, also help to mention that the diff was working well until some time ago, I don't use docker for anything. only supabase cli is using docker on my machine.

Could you try installing docker desktop for arch linux? https://docs.docker.com/desktop/install/archlinux/#install-docker-desktop

I understand it's a pain to reinstall but the CLI has to support multiple platform consistently and docker desktop is the only option available on macos and windows afaik.

We made a recent change to use host networking mode and that probably broke those installations that just had docker engine.

amr3k commented 1 year ago

Well, It's been more than an hour since I installed and ran docker desktop which is still stuck at 'Docker Desktop starting...'. This indeed is out of scope of this project, I'll leave the app open for an hour more.

if it didn't work eventually, I'll try to debug the network issue with the docker cli itself.

Update

I solved that issue with docker desktop, but couldn't use supabase with it

I uninstalled it, and after fighting some issues while trying to run docker cli again, I was able to run supabase again, and it pulled the images, and setup everything for me so well, but the main error with the diff tool still exist.

At this point I can't help but to smile remembering the old joke It's running on my machine, but now it's updated with It's running on my docker desktop

amr3k commented 1 year ago

Rolling back to v1.39.0 fixes this issue. edit v1.39.0 has issues with authentication. I tried 1.40.1 and it works both for auth and diff tool.

amr3k commented 1 year ago

One month later.. v1.40.1 broke and couldn't do diffs anymore, so I gave up and installed docker desktop, upgraded supabase to the latest version, solved some issues with docker, postgres roles ... Aaaand it works well.

dvrfluxchat commented 1 year ago
Connecting to remote database...
Retrying... db.ffvylgetjuuiwexvgjfm.supabase.co 5432
Creating shadow database...
Setting up initial schema...
Applying migration 20230724181511_remote_commit.sql...
Applying migration 20230724183217_remote_commit.sql...
Applying migration 20230725094658_add_mv_test_to_new_timestamp.sql...
Diffing schemas: extensions,public
error diffing schema: error running container: exit 1:                                                                                                 
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.1.1; however, version 23.2.1 is available.                                                                       
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.                                                    
Traceback (most recent call last):                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/schemainspect/misc.py", line 9, in connection_from_s_or_c                                               
    s_or_c.engine                                                                                                                                      
AttributeError: 'Session' object has no attribute 'engine'                                                                                             

During handling of the above exception, another exception occurred:                                                                                    

Traceback (most recent call last):                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3212, in _wrap_pool_connect                                            
    return fn()                                                                                                                                        
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 301, in connect                                                          
    return _ConnectionFairy._checkout(self)                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 761, in _checkout                                                        
    fairy = _ConnectionRecord.checkout(pool)                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 419, in checkout                                                         
    rec = pool._do_get()                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get                                                          
    self._dec_overflow()                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__                                                   
    compat.raise_(                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_                                                         
    raise exception                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 142, in _do_get                                                          
    return self._create_connection()                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 247, in _create_connection                                               
    return _ConnectionRecord(self)                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in __init__                                                         
    self.__connect()                                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 605, in __connect                                                        
    pool.logger.debug("Error on connect(): %s", e)                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__                                                   
    compat.raise_(                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_                                                         
    raise exception                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 599, in __connect                                                        
    connection = pool._invoke_creator(self)                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 578, in connect                                                      
    return dialect.connect(*cargs, **cparams)                                                                                                          
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 584, in connect                                                     
    return self.dbapi.connect(*cargs, **cparams)                                                                                                       
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect                                                             
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)                                                                             
psycopg2.OperationalError: could not connect to server: Connection refused                                                                             
        Is the server running on host "db.ffvylgetjuuiwexvgjfm.supabase.co" (3.6.38.217) and accepting                                                         
        TCP/IP connections on port 6543?                                                                                                                       

The above exception was the direct cause of the following exception:                                                                                   

Traceback (most recent call last):                                                                                                                     
  File "/usr/local/bin/migra", line 8, in <module>                                                                                                     
    sys.exit(do_command())                                                                                                                             
  File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 121, in do_command                                                              
    status = run(args)                                                                                                                                 
  File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 86, in run                                                                      
    m = Migration(                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/migra/migra.py", line 39, in __init__                                                                   
    self.changes.i_target = get_inspector(                                                                                                             
  File "/usr/local/lib/python3.9/site-packages/schemainspect/get.py", line 14, in get_inspector                                                        
    c = connection_from_s_or_c(x)                                                                                                                      
  File "/usr/local/lib/python3.9/site-packages/schemainspect/misc.py", line 14, in connection_from_s_or_c                                              
    return s_or_c.connection()                                                                                                                         
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1516, in connection                                                    
    return self._connection_for_bind(                                                                                                                  
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1526, in _connection_for_bind                                          
    return self._transaction._connection_for_bind(                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 747, in _connection_for_bind                                           
    conn = bind.connect()                                                                                                                              
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3166, in connect                                                       
    return self._connection_cls(self, close_with_result=close_with_result)                                                                             
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 96, in __init__                                                        
    else engine.raw_connection()                                                                                                                       
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3245, in raw_connection                                                
    return self._wrap_pool_connect(self.pool.connect, _connection)                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3215, in _wrap_pool_connect                                            
    Connection._handle_dbapi_exception_noconnection(                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2068, in _handle_dbapi_exception_noconnection                          
    util.raise_(                                                                                                                                       
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_                                                         
    raise exception                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3212, in _wrap_pool_connect                                            
    return fn()                                                                                                                                        
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 301, in connect                                                          
    return _ConnectionFairy._checkout(self)                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 761, in _checkout                                                        
    fairy = _ConnectionRecord.checkout(pool)                                                                                                           
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 419, in checkout                                                         
    rec = pool._do_get()                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get                                                          
    self._dec_overflow()                                                                                                                               
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__                                                   
    compat.raise_(                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_                                                         
    raise exception                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 142, in _do_get                                                          
    return self._create_connection()                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 247, in _create_connection                                               
    return _ConnectionRecord(self)                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in __init__                                                         
    self.__connect()                                                                                                                                   
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 605, in __connect                                                        
    pool.logger.debug("Error on connect(): %s", e)                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__                                                   
    compat.raise_(                                                                                                                                     
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_                                                         
    raise exception                                                                                                                                    
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 599, in __connect                                                        
    connection = pool._invoke_creator(self)                                                                                                            
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 578, in connect                                                      
    return dialect.connect(*cargs, **cparams)                                                                                                          
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 584, in connect                                                     
    return self.dbapi.connect(*cargs, **cparams)                                                                                                       
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect                                                             
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)                                                                             
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused                                           
        Is the server running on host "db.ffvylgetjuuiwexvgjfm.supabase.co" (3.6.38.217) and accepting                                                         
        TCP/IP connections on port 6543?                                                                                                                       

(Background on this error at: http://sqlalche.me/e/14/e3q8)                                                                                            

Try rerunning the command with --debug to troubleshoot the error.

We are facing the same issue.

Supabase CLI version : 1.82.1 docker version : 4.21.1 (114176) OS : macOS monterey

dvrfluxchat commented 1 year ago
[
    {
        "Id": "0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf",
        "Created": "2023-07-25T17:38:02.730976505Z",
        "Path": "/docker-entrypoint.sh",
        "Args": [
            "/bin/sh",
            "-c",
            "set -- extensions public;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] \u0026\u0026 set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 14529,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-07-25T17:38:02.791402964Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:e2d4ea346dccdef2959a01c8e38edb0582c7a1b25ffc2d849ec8b56ab83bc1e7",
        "ResolvConfPath": "/var/lib/docker/containers/0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf/hostname",
        "HostsPath": "/var/lib/docker/containers/0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf/hosts",
        "LogPath": "/var/lib/docker/containers/0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf/0d84eef098802de86c9fa3085548c798ff616164de26e9490f2d0a4b39f29ebf-json.log",
        "Name": "/agitated_leakey",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "host",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "private",
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": null,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/b53b18d12ccc833d0d8ad3b9f9b2a0326f3fd4392bf223f7cdce10921d1a16f1-init/diff:/var/lib/docker/overlay2/06377ede345808b6fdc8a50d68a4964b73de24a1a5656fa36f2db6df3702afd9/diff:/var/lib/docker/overlay2/75be104fedabcc35475de9172cbb351bc559d23db81855aac2373303cd0acbf2/diff:/var/lib/docker/overlay2/57aec128b80a8dc11f5a13d9072f6eeefb8a4829884d2da90f4ca5e6ca34cf29/diff:/var/lib/docker/overlay2/e0295d8275e858a401c094960571edee3e56c84cdff1a9e67c42d999a92f5409/diff:/var/lib/docker/overlay2/d1789616f36acc12deb93652edece1b3cf7a55cb635b35ed312f86f44cd066f2/diff:/var/lib/docker/overlay2/5caa1d993139a66b97a7b529aa644c7060e77e4aba528e2c81fd9faf1b08834d/diff:/var/lib/docker/overlay2/fd648839df2ded894e81d670ed9d54d9fe4a2aec23645969bb85bae994e779a9/diff",
                "MergedDir": "/var/lib/docker/overlay2/b53b18d12ccc833d0d8ad3b9f9b2a0326f3fd4392bf223f7cdce10921d1a16f1/merged",
                "UpperDir": "/var/lib/docker/overlay2/b53b18d12ccc833d0d8ad3b9f9b2a0326f3fd4392bf223f7cdce10921d1a16f1/diff",
                "WorkDir": "/var/lib/docker/overlay2/b53b18d12ccc833d0d8ad3b9f9b2a0326f3fd4392bf223f7cdce10921d1a16f1/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "docker-desktop",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "SOURCE=postgresql://postgres:postgres@localhost:54320/postgres",
                "TARGET=postgresql://postgres:postgres@localhost:54322/postgres?connect_timeout=10",
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
                "PYTHON_VERSION=3.9.5",
                "PYTHON_PIP_VERSION=21.1.1",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "set -- extensions public;#!/bin/sh\nset -eu\n\n# pin to latest version: https://pypi.org/project/migra/\npip install -qU migra==3.0.1663481299\n\n# migra doesn't shutdown gracefully, so kill it ourselves\ntrap 'kill -9 %1' TERM\n\nrun_migra() {\n    # additional flags for diffing extensions\n    [ \"$schema\" = \"extensions\" ] \u0026\u0026 set -- --create-extensions-only --ignore-extension-versions \"$@\"\n    migra --unsafe --schema=\"$schema\" \"$@\"\n}\n\n# accepts command line args as a list of schema to generate\nfor schema in \"$@\"; do\n    # migra exits 2 when differences are found\n    run_migra \"$SOURCE\" \"$TARGET\" || status=$?\n    if [ ${status:-2} -ne 2 ]; then\n        exit $status\n    fi\ndone\n"
            ],
            "Image": "public.ecr.aws/supabase/migra:3.0.1621480950",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.docker.compose.project": "dynamage",
                "com.supabase.cli.project": "dynamage"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "5182d86dfe80f71f6f940d8aabc7b14476779e9460c6bcc554e0e14125141354",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/default",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "host": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "704b0f855349a16156a3e70c9f6a9ec3a2b18694f4c7b6c1a1323050c6ef7148",
                    "EndpointID": "1874f9e3b865240a1d391be6986906423fa703ae428b226951fcbfb47bf04c27",
                    "Gateway": "",
                    "IPAddress": "",
                    "IPPrefixLen": 0,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "",
                    "DriverOpts": null
                }
            }
        }
    }
]

This is the output for the docker container inspect <supabase_differ_container_id>

dvrfluxchat commented 1 year ago

It suddenly started working after 2 hours of throwing the above error.

dvrfluxchat commented 1 year ago

Found a way to recreate this.

If I am connected to my WiFi this is throwing the above error. but when I connect to the hotspot on my phone this thing works. Also on WiFi it used to work before but threw a error Retrying... db.ffvylgetjuuiwexvgjfm.supabase.co 5432 . Probably has to do something with connections.

david-r-cox commented 3 months ago

If I am connected to my WiFi this is throwing the above error. but when I connect to the hotspot on my phone this thing works.

Recent iOS versions enable IPv6 by default for hotspot connections. Setting up IPv6 on my home network and enabling IPv6 in Docker resolved this issue for me.