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.04k stars 202 forks source link

Error 502 Cannot access logs in Local Development #2509

Closed ricardomatias closed 2 months ago

ricardomatias commented 2 months ago

Describe the bug When trying to view the Postgres logs in the Supabase Studio there's this error:

{
  "code": 502,
  "errors": [],
  "message": "Something went wrong! Unknown error. If this continues please contact support.",
  "status": "UNKNOWN"
}

I've changed enabled to "true" under [analytics] in config.toml.

When I execute supabase start I get the following:

WARNING: analytics requires mounting default docker socket: /var/run/docker.sock
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:postgres@127.0.0.1:54322/postgres
      Studio URL: http://127.0.0.1:54323
    Inbucket URL: http://127.0.0.1:54324
//....

If I execute with supabase start with DOCKER_HOST="unix:///var/run/docker.sock", the warning from the analytics container disappears, but I still get the same errors in Supabase Studio when trying to view the logs.

The following logs are from the supabase_analytics_database container:

2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210322193905_rename_columns_for_mnesia_compatibility.exs:3: Logflare.Repo.Migrations.RenameColumnsForMnesiaCompatibility
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210729161959_subscribe_to_postgres.exs:19: Logflare.Repo.Migrations.SubscribeToPostgres
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210729161959_subscribe_to_postgres.exs:20: Logflare.Repo.Migrations.SubscribeToPostgres
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210729161959_subscribe_to_postgres.exs:21: Logflare.Repo.Migrations.SubscribeToPostgres
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210729161959_subscribe_to_postgres.exs:22: Logflare.Repo.Migrations.SubscribeToPostgres
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20210729161959_subscribe_to_postgres.exs:23: Logflare.Repo.Migrations.SubscribeToPostgres
2024-07-10 14:51:55 
2024-07-10 14:51:55 warning: an expression is always required on the right side of ->. Please provide a value after ->
2024-07-10 14:51:55   /opt/app/rel/logflare/lib/logflare-1.4.0/priv/repo/migrations/20230727111150_update_endpoint_query_language_default_value.exs:8:13
2024-07-10 14:51:55 

Expected behavior Can see the logs.

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

sweatybridge commented 2 months ago

Do you confirm that your docker settings match this screenshot? Particularly requires Allow the default Docker socket ...

Screenshot 2024-07-10 at 8 57 10 PM
ricardomatias commented 2 months ago

Do you confirm that your docker settings match this screenshot? Particularly requires Allow the default Docker socket ...

Screenshot 2024-07-10 at 8 57 10 PM

Yes. They look like this:

image
sweatybridge commented 2 months ago

Could you also show the docker engine config?

Screenshot 2024-07-10 at 9 37 53 PM

I'm unable to reproduce on my macOS. Not sure if this helps, but it might be worth closing any studio browser tabs before supabase start.

ricardomatias commented 2 months ago

Could you also show the docker engine config?

Screenshot 2024-07-10 at 9 37 53 PM

I'm unable to reproduce on my macOS. Not sure if this helps, but it might be worth closing any studio browser tabs before supabase start.

I changed "experimental" to true and the problem persists. I also had all browser windows closed.

I see the following errors from the Studio in the Developer Tools' console window:

image
SebasScript commented 2 months ago

I am having the same issue since updating the CLI to the last version on Windows 11, before all was working without issues

same warning

WARNING: analytics requires mounting default docker socket: /var/run/docker.sock

and the error in the vector container

2024-07-11T07:06:07.904242Z ERROR source{component_kind="source" component_id=docker_host component_type=docker_logs component_name=docker_host}: vector::sources::docker_logs: Listing currently running containers failed. error=error trying to connect: Connection refused (os error 111)
2024-07-11 15:06:07 2024-07-11T07:06:07.904258Z  INFO vector: Vector has started. debug="false" version="0.28.1" arch="x86_64" revision="ff15924 2023-03-06"
2024-07-11 15:06:07 2024-07-11T07:06:07.911842Z  INFO vector::internal_events::api: API server running. address=0.0.0.0:9001 playground=http://0.0.0.0:9001/playground
2024-07-11 15:06:07 2024-07-11T07:06:07.911869Z  INFO vector::app: All sources have finished.
2024-07-11 15:06:07 2024-07-11T07:06:07.911873Z  INFO vector: Vector has stopped.

        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.29.15         │ -
    supabase/storage-api   │ v1.6.8           │ v1.6.8
    supabase/edge-runtime  │ v1.54.10         │ -
    supabase/studio        │ 20240701-05dfbec │ -
    supabase/postgres-meta │ v0.83.2          │ -
    supabase/logflare      │ 1.4.0            │ -
    supabase/supavisor     │ 1.1.56           │ -
    darthsim/imgproxy      │ v3.8.0           │ -

all other containers run, but the /vector container for the analytics tries to start and shuts down

SebasScript commented 2 months ago

On windows it is not possible to allow the docker Desktop socket to be used without a docker business subscription. Settings need to be configured via settings manager, There is are no advanced settings in the desktop app

https://docs.docker.com/desktop/hardened-desktop/enhanced-container-isolation/config/

https://docs.docker.com/desktop/hardened-desktop/settings-management/configure/

which is only available to business customers according to their docs unless i am missing something. I tried to to create a config and docker locks me out of my account and shuts down docker desktop unless i remove the config to get it to start up again.

encima commented 2 months ago

Hello, it seems there are a few open issues about this so, in an effort to clean up, we will consolidate to this one here.

The issue is mostly solved and a fix for the frontend query is coming soon.

encima commented 2 months ago

For the issues with sockets and docker configs, those are outside of the Supabase scope and can be resolved by either:

sweatybridge commented 2 months ago

@SebasScript I can successfully setup tcp daemon socket on docker CE without a business subscription. could you try the docker settings here https://github.com/supabase/cli/issues/2538#issuecomment-2246855270

SebasScript commented 2 months ago

@sweatybridge thanks for letting me know.