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.09k stars 212 forks source link

Error deploying Edge Function - 'Error: Permission denied (os error 13)' #2934

Closed lucasmrl closed 2 days ago

lucasmrl commented 2 days ago

Describe the bug I am trying to deploy a simple edge function, but I am unable to do this due to: Error: Permission denied (os error 13).

The function works fine locally. I'm on a mac. I tried temporarily setting the project folder to full permissions (777). (chmod -R 777 path), but didn't work.

To Reproduce I am using the 'hello world' example available:

  1. Create an empty folder
  2. Run supabase init
  3. Generate VS Code settings for Deno. [y/N] y: yes
  4. Run supabase functions new hello-world
  5. Run supabase start
  6. Validate that the function is running as expected - it is!
  7. Run supabase functions deploy hello-world --project-ref <my-project-id>

Error:

WARN: no seed files matched pattern: supabase/seed.sql Bundling Function: hello-world Download https://jsr.io/@supabase/functions-js/meta.json Download https://jsr.io/@supabase/functions-js/2.4.3_meta.json Error: Permission denied (os error 13) error running container: exit 1 Try rerunning the command with --debug to troubleshoot the error.

Expected behavior Deploy my function into my supabase project.

Screenshots Logs with debug enabled:

Supabase CLI 1.223.10 WARN: no seed files matched pattern: supabase/seed.sql 2024/11/30 02:46:29 DNS Start: {Host:api.supabase.com} ..... 2024/11/30 02:46:29 TLS Start 2024/11/30 02:46:29 TLS Done: .... 2024/11/30 02:46:29 Sent Header: :authority [api.supabase.com] 2024/11/30 02:46:29 Sent Header: :method [GET] 2024/11/30 02:46:29 Sent Header: :path [/v1/projects//functions] 2024/11/30 02:46:29 Sent Header: :scheme [https] 2024/11/30 02:46:29 Sent Header: authorization [Bearer ...] 2024/11/30 02:46:29 Sent Header: user-agent [SupabaseCLI/1.223.10] 2024/11/30 02:46:29 Sent Header: accept-encoding [gzip] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte Bundling Function: hello-world 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Sent Header: Content-Length [265] 2024/11/30 02:46:29 Sent Header: Content-Type [application/json] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Sent Header: Content-Length [131] 2024/11/30 02:46:29 Sent Header: Content-Type [application/json] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Sent Header: Content-Length [2047] 2024/11/30 02:46:29 Sent Header: Content-Type [application/json] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Sent Header: Content-Length [0] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte 2024/11/30 02:46:29 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:29 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:29 Send Done 2024/11/30 02:46:29 Recv First Byte DEBUG Opening cache /root/.cache/deno/dep_analysis_cache_v1... DEBUG Opening cache /root/.cache/deno/node_analysis_cache_v1... DEBUG FileFetcher::fetch_no_follow_with_options - specifier: file:///Users//test-app/supabase/functions/hello-world/index.ts DEBUG FileFetcher::fetch_no_follow_with_options - specifier: https://jsr.io/@supabase/functions-js/meta.json DEBUG FileFetcher::fetch_remote_no_follow - specifier: https://jsr.io/@supabase/functions-js/meta.json Download https://jsr.io/@supabase/functions-js/meta.json DEBUG starting new connection: https://jsr.io/ DEBUG No cached session for DnsName("jsr.io") DEBUG Not resuming any session DEBUG Using ciphersuite TLS13_AES_256_GCM_SHA384 DEBUG Not resuming DEBUG TLS1.3 encrypted extensions: [Protocols([ProtocolName(6832)])] DEBUG ALPN protocol is Some(b"h2") DEBUG FileFetcher::fetch_cached_no_follow - specifier: https://jsr.io/@supabase/functions-js/meta.json DEBUG FileFetcher::fetch_no_follow_with_options - specifier: https://jsr.io/@supabase/functions-js/2.4.3_meta.json DEBUG FileFetcher::fetch_remote_no_follow - specifier: https://jsr.io/@supabase/functions-js/2.4.3_meta.json Download https://jsr.io/@supabase/functions-js/2.4.3_meta.json DEBUG FileFetcher::fetch_no_follow_with_options - specifier: https://jsr.io/@supabase/functions-js/2.4.3/src/edge-runtime.d.ts DEBUG FileFetcher::fetch_remote_no_follow - specifier: https://jsr.io/@supabase/functions-js/2.4.3/src/edge-runtime.d.ts DEBUG FileFetcher::fetch_cached_no_follow - specifier: https://jsr.io/@supabase/functions-js/2.4.3/src/edge-runtime.d.ts Error: Permission denied (os error 13) 2024/11/30 02:46:30 Sent Header: Host [api.moby.localhost] 2024/11/30 02:46:30 Sent Header: User-Agent [Docker-Client/unknown-version (darwin)] 2024/11/30 02:46:30 Send Done 2024/11/30 02:46:30 Recv First Byte error running container: exit 1

System information

supabase/postgres │ 15.6.1.139 │ - supabase/gotrue │ v2.164.0 │ - postgrest/postgrest │ v12.2.0 │ - supabase/realtime │ v2.30.34 │ - supabase/storage-api │ v1.11.13 │ - supabase/edge-runtime │ v1.62.2 │ - supabase/studio │ 20241106-f29003e │ - supabase/postgres-meta │ v0.84.2 │ - supabase/logflare │ 1.4.0 │ - supabase/supavisor │ 1.1.56 │ -

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

avallete commented 2 days ago

Couldn't reproduce on my end with a fresh install and the exact same settings (docker, cli, os).

Did you try supabase --stop --all and start again ?

Would you mind sharing what are your supabase folders permissions ? According to the error message something might be on with that you should have something like:

ls -lR ./supabase
total 24
-rw-r--r--@ 1 avallete  staff  9106 Nov 30 17:02 config.toml
drwxr-xr-x@ 3 avallete  staff    96 Nov 30 17:02 functions

./supabase/functions:
total 0
drwxr-xr-x@ 3 avallete  staff  96 Nov 30 17:02 hello-world

./supabase/functions/hello-world:
total 8
-rw-r--r--@ 1 avallete  staff  1095 Nov 30 17:02 index.ts
lucasmrl commented 2 days ago

Thanks for the quick reply @avallete . I stopped and started, but it didn't work. I also tried using Rancher Desktop but had no luck. Reinstalling Docker didn't work either.

lucas@MacBookAir test-app % ls -lR ./supabase total 24 -rw-r--r-- 1 lucas staff 9107 Nov 30 02:42 config.toml drwxr-xr-x 3 lucas staff 96 Nov 30 02:43 functions ./supabase/functions: total 0 drwxr-xr-x 3 lucas staff 96 Nov 30 02:43 hello-world ./supabase/functions/hello-world: total 8 -rw-r--r-- 1 lucas staff 1095 Nov 30 02:43 index.ts

lucasmrl commented 2 days ago

I was finally able to deploy. It seems that the issue was related to the terminal I was using in vs code. Still not 100% clear how it happened though. I will try to replicate it later and come back. For now, it's good. :)