cli icon indicating copy to clipboard operation
cli copied to clipboard

`supabase start` fails on linked project

Open Aietes opened this issue 1 year ago • 1 comments

Describe the bug When trying to run supabase start or supabase db start on a linked project the command fails with:

2024/07/04 16:04:35 Send Done
2024/07/04 16:04:35 Recv First Byte
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/app/dist/scripts/migrate-call.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.15.0
2024/07/04 16:04:35 Sent Header: Host [api.moby.localhost]
2024/07/04 16:04:35 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)]
2024/07/04 16:04:35 Send Done
2024/07/04 16:04:35 Recv First Byte

To Reproduce Steps to reproduce the behavior:

  1. Run supabase start -> starts successfully
  2. Run supabase stop
  3. Run supabase link with brand new project
  4. Run supabase start, or supabase db start, and it will fail.

When linking the project I get the warning, although the config has been created with supabase init and not been altered or changed in any way.

Warning: Local config differs from linked project. Try updating supabase/config.toml
[api]
enabled = true
port = 54321
schemas = ["public", "graphql_public"]
extra_search_path = ["public", "extensions"]
max_rows = 1000

Expected behavior For supabase start to work when a project is linked.

Screenshots If applicable, add screenshots to help explain your problem.

System information Rerun the failing command with --create-ticket flag.

  • Ticket ID: [e.g. ab1ac733e31e4f928a4d7c8402543712]
  • Version of OS: [e.g. Ubuntu 22.04]
  • Version of CLI: [e.g. v1.60.0]
  • Version of Docker: [e.g. v25.0.3]
  • Versions of services: [output from supabase services command]
      SERVICE IMAGE      │      LOCAL       │  LINKED
    supabase/postgres      │ 15.1.1.73        │ 15.1.1.73
    supabase/gotrue        │ v2.154.2         │ v2.154.2
    postgrest/postgrest    │ v12.2.1          │ v12.2.1
    supabase/realtime      │ v2.28.32         │ -
    supabase/storage-api   │ v1.6.7           │ v1.6.7
    supabase/edge-runtime  │ v1.54.6          │ -
    supabase/studio        │ 20240422-5cf8f30 │ -
    supabase/postgres-meta │ v0.80.0          │ -
    supabase/logflare      │ 1.4.0            │ -
    supabase/supavisor     │ 1.1.56           │ -
    darthsim/imgproxy      │ v3.8.0           │ -

Additional context If applicable, add any other context about the problem here.

  • supabase 1.178.2 via npx
  • Version of Node.js [e.g. v16.20.0] tried with 20.12.2 and 22.3.0

Aietes avatar Jul 04 '24 14:07 Aietes

supabase/cli/internal/db/start/start.go

image

RobinGiel avatar Jul 04 '24 18:07 RobinGiel

@fenos did we change the location of migrate script in recent storage version?

sweatybridge avatar Jul 05 '24 01:07 sweatybridge

I'm having the same issue

YA9 avatar Jul 05 '24 04:07 YA9

The current workaround is to rm supabase/.temp/storage-version before supabase start. We will look into it more closely next week.

sweatybridge avatar Jul 05 '24 04:07 sweatybridge

Thank you so much! I was going crazy over this

YA9 avatar Jul 05 '24 08:07 YA9

Thank you for looking into it. However, the workaround does not work for me. When I delete storage-version and run supabase start, I now get a different error:

Error response from daemon: failed to resolve reference "public.ecr.aws/supabase/postgrest:v12.2.1": public.ecr.aws/supabase/postgrest:v12.2.1: not found

Aietes avatar Jul 05 '24 09:07 Aietes

I have the same issue when running supabase db diff. I've tried with v1.150.0 and v1.178.2. supabase start worked well though.

But thanks for this rm supabase/.temp/storage-version - fixed it for now 🎊

techwizzdom avatar Jul 05 '24 09:07 techwizzdom

Thank you for looking into it. However, the workaround does not work for me. When I delete storage-version and run supabase start, I now get a different error:

Error response from daemon: failed to resolve reference "public.ecr.aws/supabase/postgrest:v12.2.1": public.ecr.aws/supabase/postgrest:v12.2.1: not found

This is due to a new postgrest release that we haven't mirrored to ECR. I've just completed the mirroring job so it should be resolved now. Could you try again?

sweatybridge avatar Jul 05 '24 10:07 sweatybridge

@sweatybridge Thank you, the workaround is now working.

Aietes avatar Jul 08 '24 10:07 Aietes

@sweatybridge

I am running supabase db diff command to create migrations Node js version : 18.17.0 Supabase cli version: Tried with 1.183.5 and also with beta version 1.186.2 docker version: 27.0.3

after running npx supabase start command I run npx supabase db diff

error diffing schema: error running container: exit 1: Traceback (most recent call last): File "/usr/local/bin/migra", line 8, in 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 98, in run m.add_all_changes(privileges=args.with_privileges) File "/usr/local/lib/python3.9/site-packages/migra/migra.py", line 107, in add_all_changes self.add(self.changes.tables_only_selectables()) File "/usr/local/lib/python3.9/site-packages/migra/changes.py", line 496, in get_selectable_changes statements += get_table_changes( File "/usr/local/lib/python3.9/site-packages/migra/changes.py", line 233, in get_table_changes rls_alter = v.alter_rls_statement File "/usr/local/lib/python3.9/site-packages/schemainspect/pg/obj.py", line 228, in alter_rls_statement return self.alter_table_statement(self.alter_rls_clause) File "/usr/local/lib/python3.9/site-packages/schemainspect/pg/obj.py", line 145, in alter_table_statement raise NotImplementedError

could you please help me to fix this issue ??

RishabhPachori avatar Jul 12 '24 14:07 RishabhPachori

@RishabhPachori could you please open a new issue as it's unrelated?

line 145, in alter_table_statement raise NotImplementedError

That problem is due to a limitation of migra tool which doesn't support generating alter rls statement.

sweatybridge avatar Jul 12 '24 14:07 sweatybridge