Error status 502: An invalid response was received from the upstream server on supabase start with blank project
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
I have correctly installed the latest version of the Supabase CLI and set up a new project with supabase init. I then have created a new supabase edge function with the supabase functions new
All the image are correctly downloaded and the containers launched (all that one) but at the very end when the command is performing the healthcheck, everything kind of crash and appears the error
...
2024/10/09 19:42:24 Recv First Byte
2024/10/09 19:42:25 Sent Header: Host [api.moby.localhost]
2024/10/09 19:42:25 Sent Header: User-Agent [Docker-Client/unknown-version (linux)]
2024/10/09 19:42:25 Send Done
2024/10/09 19:42:25 Recv First Byte
2024/10/09 19:42:26 Sent Header: Host [api.moby.localhost]
2024/10/09 19:42:26 Sent Header: User-Agent [Docker-Client/unknown-version (linux)]
2024/10/09 19:42:26 Send Done
2024/10/09 19:42:26 Recv First Byte
2024/10/09 19:42:27 Sent Header: Host [api.moby.localhost]
2024/10/09 19:42:27 Sent Header: User-Agent [Docker-Client/unknown-version (linux)]
2024/10/09 19:42:27 Send Done
2024/10/09 19:42:27 Recv First Byte
2024/10/09 19:42:28 Sent Header: Host [api.moby.localhost]
2024/10/09 19:42:28 Sent Header: User-Agent [Docker-Client/unknown-version (linux)]
2024/10/09 19:42:28 Send Done
2024/10/09 19:42:28 Recv First Byte
2024/10/09 19:42:28 Connect Start: tcp 127.0.0.1:54321
2024/10/09 19:42:28 Connect Done: tcp 127.0.0.1:54321
2024/10/09 19:42:28 Sent Header: Host [127.0.0.1:54321]
2024/10/09 19:42:28 Sent Header: User-Agent [SupabaseCLI/1.203.0]
2024/10/09 19:42:28 Sent Header: Authorization [Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3M<more chars>0YpN81IU]
2024/10/09 19:42:28 Sent Header: Accept-Encoding [gzip]
2024/10/09 19:42:28 Send Done
2024/10/09 19:42:28 Recv First Byte
Stopping containers...
Pruned containers: [48140ad3aedf28e4b805ef53726391f7845852074e9071e33704bc72ba7e8113 576776629a4791004812be070bc57a2925d0aea11910fb172f21f99e5c0d7e82 71f4256bd86a189f080870b96a1ba2fd55de98eeeb18ea7dd88b43790c7c589f 04df85256addf17050109168d06a47efacfc517af6df83bf4393f26326151242 4d54c7b8e723db4f801f288f2abc9da87fd222a346a001d502d7b5578523d549 59dd3fbe7a3b486513a540fd5f31fc1b65795ae5f99c44760efd3f20f633ba45 7b2dad8e1ca8fed05716eca84d26e5d6e7e2510bfdef660192e1edbecbff42bf 8f375c7b58d23a29d634212c30c7cc26b278786a79a453b5d8f1cbb029ecd769 046e6ed0bf3f85e3c409b638b657412fd866ddbef9b6f22cea68518faa9a83c6 d22e0ff147bfd3bb316733ecc239b4b2ca922ac134c041ee5c0108ac9663e4eb c9aed2ed6e087d2d9ca0af0ee273fc3c1ebd331acb82468e6d8858b50ed794a9 af80dae956ac6eeb03223934081877369c9945176f3cc70369a64bb3b95eeecd 151a240345f8e5ff93e4ce8859250d9ff39cdf1c85a37cfdfc35ea010f98af5f]
Pruned volumes: [supabase_db_content-bridge-backend supabase_config_content-bridge-backend supabase_inbucket_content-bridge-backend supabase_storage_content-bridge-backend supabase_edge_runtime_content-bridge-backend]
Pruned network: [supabase_network_content-bridge-backend]
Error status 502: An invalid response was received from the upstream server
To Reproduce
Create a clean installation with
supabase init
supabase functions new my-function
supabase start
Expected behavior
The local deployment starts running
Screenshots
System information
Ubuntu 24.04.1 LTS 6.8.0-45-generic on a VirtualBox VM machine. I have tried both with network card bridged or NAT on the guest but same issue
Additional context
Spinned up another VM with the same setup on a different hosting machine (always on Virtualbox) and having the same issue
Status: Downloaded newer image for public.ecr.aws/supabase/postgres-meta:v0.83.2
20240930-16f2b8e: Pulling from supabase/studio
302e3ee49805: Already exists
12d91d8d3f33: Pull complete
3c47054f1b46: Pull complete
357b88b87995: Pull complete
06a1fd3314fb: Pull complete
a8370f63df63: Pull complete
2509fed50a78: Pull complete
91effe94910a: Pull complete
e48c03195175: Pull complete
564d10fcb534: Pull complete
Digest: sha256:b51d384a7b5da34e2011ab314aef53cf8f06ceaa009af4a6e21079c21d3493dc
Status: Downloaded newer image for public.ecr.aws/supabase/studio:20240930-16f2b8e
Stopping containers...
Error status 502: An invalid response was received from the upstream server
Running again the supabase start I have
No seed files matched pattern: supabase/seed.sql
Seeding globals from roles.sql...
Stopping containers...
Error status 502: An invalid response was received from the upstream server
+1 here. Rolling back to CLI v1.192.5 fixes both issues. I would also note that when I went to 1.204.3, I could not start Supabase either. Sorry, I did not save the error.
@nyannyacha could this be related to edge runtime update? https://github.com/supabase/cli/pull/2733
I believe there are no changes in edge runtime v1.58.12 other than the ability to use an mjs extension as an entry point for functions.
I tried to reproduce the problem using the develop branch of the supabase/cli by typing the commands in the description, but the edge runtime container returned a normal response.
Note that my attempt was on OrbStack, where no special network config exists for the guest vm.
@NicoCaldo could you try supabase start --ignore-health-check as a workaround?
If that works, please show me the output from docker ps to help debug the root cause.
@NicoCaldo could you try
supabase start --ignore-health-checkas a workaround?If that works, please show me the output from
docker psto help debug the root cause.
It worked but it says that the supabase_storage_bakend container is unhelthy
No seed files matched pattern: supabase/seed.sql
Seeding globals from roles.sql...
supabase_storage_backend container logs:
supabase_storage_backend container is not ready: unhealthy
Started supabase local development setup.
API URL: http://127.0.0.1:54321
GraphQL URL: http://127.0.0.1:54321/graphql/v1
S3 Storage URL: http://127.0.0.1:54321/storage/v1/s3
DB URL: postgresql://postgres:[email protected]:54322/postgres
Studio URL: http://127.0.0.1:54323
Inbucket URL: http://127.0.0.1:54324
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
anon key: eyJhbGciOiJIUzI1NiIsInR5cYTn_I0
service_role key: eyJhbGciOiJIW0YpN81IU
S3 Access Key: 625729a08b95bf1b7ff351a663f3a23c
S3 Secret Key: 850181e47307425907
S3 Region: local
docker ps output
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5bd32edc73a1 public.ecr.aws/supabase/studio:20240930-16f2b8e "docker-entrypoint.s…" 2 minutes ago Up 2 minutes (healthy) 0.0.0.0:54323->3000/tcp, [::]:54323->3000/tcp supabase_studio_backend
60b5df86dca4 public.ecr.aws/supabase/postgres-meta:v0.83.2 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes (healthy) 8080/tcp supabase_pg_meta_backend
b56cdb42687b public.ecr.aws/supabase/edge-runtime:v1.58.12 "sh -c 'cat <<'EOF' …" 2 minutes ago Up 2 minutes 8081/tcp supabase_edge_runtime_backend
ac481805ba4f public.ecr.aws/supabase/imgproxy:v3.8.0 "imgproxy" 2 minutes ago Up 2 minutes (healthy) 8080/tcp supabase_imgproxy_backend
134f1b973c01 public.ecr.aws/supabase/storage-api:v1.11.13 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes (healthy) 5000/tcp supabase_storage_backend
b224b44d1d30 public.ecr.aws/supabase/postgrest:v12.2.0 "/bin/postgrest" 2 minutes ago Up 2 minutes 3000/tcp supabase_rest_backend
16f45327f99b public.ecr.aws/supabase/realtime:v2.30.34 "/usr/bin/tini -s -g…" 2 minutes ago Up 2 minutes (healthy) 4000/tcp supabase_realtime_backend
eeb7848f14bf public.ecr.aws/supabase/inbucket:3.0.3 "/start-inbucket.sh …" 2 minutes ago Up 2 minutes (healthy) 1100/tcp, 2500/tcp, 0.0.0.0:54324->9000/tcp, [::]:54324->9000/tcp supabase_inbucket_backend
cb8c3ac7c51f public.ecr.aws/supabase/gotrue:v2.158.1 "auth" 2 minutes ago Up 2 minutes (healthy) 9999/tcp supabase_auth_backend
b482a1e30dbe public.ecr.aws/supabase/kong:2.8.1 "sh -c 'cat <<'EOF' …" 2 minutes ago Up 2 minutes (healthy) 8001/tcp, 8088/tcp, 8443-8444/tcp, 0.0.0.0:54321->8000/tcp, [::]:54321->8000/tcp supabase_kong_backend
786c829ae70c public.ecr.aws/supabase/vector:0.28.1-alpine "sh -c 'cat <<'EOF' …" 2 minutes ago Up 2 minutes (healthy) supabase_vector_backend
7f833fbdb075 public.ecr.aws/supabase/logflare:1.4.0 "sh -c 'cat <<'EOF' …" 2 minutes ago Up 2 minutes (healthy) 0.0.0.0:54327->4000/tcp, [::]:54327->4000/tcp supabase_analytics_backend
b05a31c38b82 public.ecr.aws/supabase/postgres:15.1.1.78 "sh -c 'cat <<'EOF' …" 3 minutes ago Up 3 minutes (healthy) 0.0.0.0:54322->5432/tcp, [::]:54322->5432/tcp supabase_db_backend
6f7a9111b160 inngest/inngest "inngest dev -u http…" 25 hours ago Up 16 minutes 0.0.0.0:8288->8288/tcp, :::8288->8288/tcp trusting_heisenberg
It seems that now that --ignore-health-check doesn't work. Actually, it doesn't ignore the health checks that are performed no matter what (CLI 1.207.9)
Excluding storage-api I was able to start it up
supabase start --ignore-health-check --exclude storage-api
I had a similar issue, where supabase start would fail with
Error status 502: An invalid response was received from the upstream server
Turned out it was due to DHCP on my local network setting a "Local Domain Name". Supabase internal proxy would try to resolve the IP of supabase_storage_<id>.<the_local_domain_name> rather than just supabase_storage_<id>, and that would fail.
The workaround is simply to change local network (in my case, it worked using a tethering network over cellular data). Hope this helps!