cwdevteam / mesa

https://mesa-wallet.vercel.app
1 stars 1 forks source link

Use supabase CLI to link and pull DB #2

Closed neatonk closed 1 month ago

neatonk commented 8 months ago

See #1

E.g.

supabase link --project-ref <project-id>
# You can get <project-id> from your project's dashboard URL: https://supabase.com/dashboard/project/<project-id>
supabase db pull
neatonk commented 8 months ago

Got it working by running the postinstall script manually:

https://github.com/supabase/cli/issues/1565

neatonk commented 8 months ago

A few more steps were needed to get the project linked:

mesa on  main [!?] via  v16.15.1 
❯ bunx supabase init
Generate VS Code workspace settings? [y/N] y
Open the mesa.code-workspace file in VS Code.
Finished supabase init.

mesa on  main [!?] via  v16.15.1 took 3s 
❯ bunx supabase link --project-ref ewvzsofyvxcctuxxqibo
Enter your database password (or leave blank to skip): 
2023/10/11 11:27:28 Access token not provided. Supply an access token by running supabase login or setting the SUPABASE_ACCESS_TOKEN environment variable.

mesa on  main [!?] via  v16.15.1 took 5m17s 
❯ bunx supabase login                                  
You can generate an access token from https://supabase.com/dashboard/account/tokens
Enter your access token: 
Finished supabase login.

mesa on  main [!?] via  v16.15.1 took 45s 
❯ bunx supabase link --project-ref ewvzsofyvxcctuxxqibo
Enter your database password (or leave blank to skip): 
failed to connect to `host=db.ewvzsofyvxcctuxxqibo.supabase.co user=postgres database=postgres`: failed SASL auth (FATAL: SASL authentication failed (SQLSTATE 08P01))
Try rerunning the command with --debug to troubleshoot the error.

mesa on  main [!?] via  v16.15.1 took 17s 
❯ bunx supabase link --project-ref ewvzsofyvxcctuxxqibo
Enter your database password (or leave blank to skip): 
failed to connect to `host=db.ewvzsofyvxcctuxxqibo.supabase.co user=postgres database=postgres`: failed SASL auth (FATAL: SASL authentication failed (SQLSTATE 08P01))
Try rerunning the command with --debug to troubleshoot the error.

mesa on  main [!?] via  v16.15.1 took 2s 
❯ bunx supabase link --project-ref ewvzsofyvxcctuxxqibo
Enter your database password (or leave blank to skip): 
Retrying... db.ewvzsofyvxcctuxxqibo.supabase.co 5432
Finished supabase link.
neatonk commented 8 months ago

It looks like the init step setup a local project, so this is trying to pull form a local db instead of the remote db. Leaving this here for later, since it is optional.

❯ bunx supabase db pull
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  in github.com/supabase/cli/internal/utils.AssertDockerIsRunning:50                             
  in github.com/supabase/cli/internal/db/pull.Run:33                                             
Try rerunning the command with --debug to troubleshoot the error.