swyxio / swyxdotio

This is the repo for swyx's blog - Blog content is created in github issues, then posted on swyx.io as blog pages! Comment/watch to follow along my blog within GitHub
https://swyx.io
MIT License
325 stars 43 forks source link

What to do when `supabase start` doesn't work - Bind for 0.0.0.0:54322 failed: port is already allocated and ERROR: schema "auth" does not exist #496

Closed swyxio closed 6 months ago

swyxio commented 6 months ago

slug: supabase-start-no-work category: note

I recently fired up a supabase project and got two very strange errors:

Error 1:

$ npx supabase start
Error response from daemon: driver failed programming external connectivity on endpoint supabase_db_smol-talk-chatbot (4eaae0e477fcbd8f9df74f8f46627b690e012c79039e6e66b8f0fc944b2fdb4d): Bind for 0.0.0.0:54322 failed: port is already allocated

$ lsof -i :54322 
COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ssh     4806 swyx   19u  IPv4 0xf3b8f5efcf4d6aaf      0t0  TCP *:54322 

killing that process temporarily solves the problem, and then you run into the second error:

Error 2:

$ npx supabase start

v2.92.1: Pulling from supabase/gotrue
4060ece20d7a: Pull complete 
dda6468f98aa: Pull complete 
20ab543ed620: Pull complete 
1c6042e25d55: Pull complete 
53d6979e59b6: Pull complete 
Digest: sha256:c27d9c8f7aeebce818ec4943216cb05c6811cf03fd83186df9400fc89d69cc6b
Status: Downloaded newer image for public.ecr.aws/supabase/gotrue:v2.92.1
Applying migration 20230707053030_init.sql...
ERROR: schema "auth" does not exist (SQLSTATE 3F000)        
At statement 0: create table "public"."chats" (             
    "id" text not null,                                     
    "user_id" uuid null default auth.uid (),                
    "payload" jsonb                                         
)                                                    

what does it mean for supabase to NOT have an auth table? Especially on a previously working project? I tried adding auth.enabled to the config.toml but that didn't work.

The problem - 2 projects live

It took me a couple hours to figure out what was going on - I had TWO concurrently running supabase projects going on - despite having done a full system reset, somehow the docker container for the old project was still going. The clue was in the project name - which i had ignored - but shouldn't have.

image

fire it up and stop it:

image

Once I opened up the old project, ran supabase stop on that one, then went back to my current project, supabase start worked like a treat.

Putting this up because googling my errors didnt find this solution in other issues:

swyxio commented 4 months ago

just validated that this became an issue again today, and added the 2 screenshots you now see to triple confirm that this happens repeatedly for me