5

I am running Windows 11 and have installed the supabase cli via Scoop per the documentation. I am adding it to an existing repository so I have already ran the below commands with no issue:

supabase login
supabase init

When I go to run supabase start it fully installed the docker image and everything the first time, but it always ends with the below error message:

> supabase start
Database is not healthy.
Error: failed to connect to `host=localhost user=postgres database=postgres`: failed to receive message (unexpected EOF)
Try rerunning the command with --debug to troubleshoot the error.

I tried running with the --debug flag as instructed but I can't seem to tell any info from that and it fails with a different issue:

...                                                                                                        2023/03/11 22:46:09 Send Done
2023/03/11 22:46:09 Recv First Byte
2023/03/11 22:46:10 Sent Header: Host [docker]
2023/03/11 22:46:10 Sent Header: User-Agent [Go-http-client/1.1]
2023/03/11 22:46:10 Send Done
2023/03/11 22:46:10 Recv First Byte
Database is not healthy.
2023/03/11 22:46:11 Connect Start: tcp [::1]:54322
2023/03/11 22:46:11 Connect Done: tcp [::1]:54322
2023/03/11 22:46:11 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:13 Connect Start: tcp 127.0.0.1:54322
2023/03/11 22:46:13 Connect Done: tcp 127.0.0.1:54322
2023/03/11 22:46:13 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:15 Connect Start: tcp [::1]:54322
2023/03/11 22:46:15 Connect Done: tcp [::1]:54322
2023/03/11 22:46:15 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
2023/03/11 22:46:17 Connect Start: tcp 127.0.0.1:54322
2023/03/11 22:46:17 Connect Done: tcp 127.0.0.1:54322
2023/03/11 22:46:17 PG Send: {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"database":"postgres","user":"postgres"}}
Error: failed to connect to `host=localhost user=postgres database=postgres`: failed to receive message (timeout: context deadline exceeded)

I am running with just the default config.toml from supabase init

Versions:

> docker --version
Docker version 20.10.22, build 3a2c30b
> docker-compose --version
Docker Compose version v2.15.1
> supabase -v
1.40.1
Azarath
  • 81
  • 6
  • Have you tried to change the resolver e.g `--dns-resolver https`? Both errors appear related to being unable to connect with Postgres. Also, which is the docker image you are using? – Mansueli Mar 12 '23 at 04:47
  • So the 1st time I ran this it kept failing (hence the bounty). But whilst I get this Database is not healthy error still and on occasions it fails, it now succeeds more often than not and the connections are all healthy – Andrew Allen Apr 05 '23 at 14:50

1 Answers1

2

I only have superficial knowledge of supabase but, according to the symptoms you described, it seems that from time to time the postgresql container is unable to provide a health probe fast enough and that makes the supabase start command to fail.

The problem is especially of relevance the first time you issue supabase start because in that case the postgresql container should initialize the required database structures and associated stuff.

As stated for example in this related Github issue I think the problem could be very likely motivated by insufficient physical machine resources.

Unfortunately, AFAIK, supabase doesn't provide any flag or configuration option for defining some type of timeout for controlling how long to wait for the health probes.

To solve the problem, you may try running the product using the supabase start --ignore-health-check flag:

supabase start --ignore-health-check

but probably the way to go should be vertical scaling your physical machine providing more resources, especially RAM memory. It running Windows 11 probably you will need to configure the Docker for Windows memory limits: this related SO question could be of help regarding this configuration as well.

jccampanero
  • 50,989
  • 3
  • 20
  • 49