supabase: Studio: 502 error for cron or edge functions logs on localhost
Describe the bug
Error 502 is shown when trying to view logs for cron or edge functions. All other types of logs work as expected.
Error ERROR 42703 (undefined_column) column "body" does not exist appears in logflare logs (see below).
To Reproduce Steps to reproduce the behavior:
- Follow steps from thread on similar issue
- Open Supabase Studio in browser
- Go to log section “Cron” or “Edge Functions”
- See error
{
"code": 502,
"errors": [],
"message": "Something went wrong! Unknown error. If this continues please contact support.",
"status": "UNKNOWN"
}
Expected behavior Logs are shown.
System information
Rerun the failing command with --create-ticket flag.
- Ticket ID: -
- Version of OS: MacOS 14.5
- Version of CLI: 2.9.6 or 2.9.7 (beta)
- Version of Docker: 27.4.0, build bde2b89
- Versions of services: (for CLI v2.9.6)
Additional context If applicable, add any other context about the problem here.
- Browser: Version 1.74.50 Chromium: 132.0.6834.111
- similar issue on self-hosted env: https://github.com/supabase/supabase/issues/26309
- Error message in docker log from
supabase/logflare:1.4.0:
log
2025-01-30 11:46:55
2025-01-30 11:46:55 10:46:55.566 [error] GenServer {Logflare.Endpoints.Cache, 1, %{"iso_timestamp_start" => "2025-01-30T09:00:00.000Z", "project" => "default", "project_tier" => "ENTERPRISE", "ref" => "default", "sql" => "select id, function_edge_logs.timestamp, event_message, response.status_code, request.method, m.function_id, m.execution_time_ms, m.deployment_id, m.version from function_edge_logs\n cross join unnest(metadata) as m\n cross join unnest(m.response) as response\n cross join unnest(m.request) as request\n \n order by timestamp desc\n limit 100\n "}} terminating
2025-01-30 11:46:55 ** (Postgrex.Error) ERROR 42703 (undefined_column) column "body" does not exist
2025-01-30 11:46:55
2025-01-30 11:46:55 query: WITH retention AS (SELECT (CASE WHEN $1::text = 'FREE' THEN current_timestamp - INTERVAL '1 day' WHEN $2::text = 'PRO' THEN current_timestamp - INTERVAL '7 day' WHEN ($3::text = 'PAYG' OR $4::text = 'ENTERPRISE') THEN current_timestamp - INTERVAL '90 day' ELSE current_timestamp - INTERVAL '1 day' END) AS date), edge_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_7f013886_454c_40f7_b8f6_650df2c242ab" AS t WHERE (t.body ->> 'project') = $5::text AND CASE WHEN COALESCE($6::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($7::text AS TIMESTAMP) END AND CASE WHEN COALESCE($8::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($9::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), postgres_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_1cbea6ce_f62e_4b72_8095_bfebf6606593" AS t WHERE (t.body ->> 'project') = $10::text AND CASE WHEN COALESCE($11::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($12::text AS TIMESTAMP) END AND CASE WHEN COALESCE($13::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($14::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), function_edge_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_ea4f51a1_529a_4354_9086_aab422b217f0" AS t WHERE CASE WHEN COALESCE($15::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($16::text AS TIMESTAMP) END AND CASE WHEN COALESCE($17::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($18::text AS TIMESTAMP) END AND (body #>> '{metadata,project_ref}') = $19::text AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), function_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_df00e22b_ae9a_4e4e_9ed6_c1e68c71dce5" AS t WHERE (body #>> '{metadata,project_ref}') = $20::text AND CASE WHEN COALESCE($21::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($22::text AS TIMESTAMP) END AND CASE WHEN COALESCE($23::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($24::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), auth_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_fede7dae_3efb_4ed4_a757_00d7f4661784" AS t WHERE (t.body ->> 'project') = $25::text AND CASE WHEN COALESCE($26::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($27::text AS TIMESTAMP) END AND CASE WHEN COALESCE($28::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($29::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), realtime_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_3759adf5_1d0f_4f8f_8cd8_3a70d717cb30" AS t WHERE (body #>> '{metadata,project}') = $30::text AND CASE WHEN COALESCE($31::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($32::text AS TIMESTAMP) END AND CASE WHEN COALESCE($33::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($34::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), storage_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_b2553f6a_0d12_4deb_aa65_8adce117ffc1" AS t WHERE (body #>> '{metadata,project}') = $35::text AND CASE WHEN COALESCE($36::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($37::text AS TIMESTAMP) END AND CASE WHEN COALESCE($38::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) <= CAST($39::text AS TIMESTAMP) END AND CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > retention.date ORDER BY CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) DESC), postgrest_logs AS (SELECT (t.body -> 'timestamp') AS timestamp, (t.body -> 'id') AS id, (t.body -> 'event_message') AS event_message, (t.body -> 'metadata') AS metadata FROM retention, "_analytics"."log_events_43e56e0f_438d_496b_aed1_4758c5b6b258" AS t WHERE CASE WHEN COALESCE($40::text, '') = '' THEN true ELSE CAST((to_timestamp(CAST((t.body ->> 'timestamp') AS BIGINT) / 1000000.0) AT TIME ZONE 'UTC') AS TIMESTAMP) > CAST($41::text AS TIMESTAMP) END AND CASE WHEN COALESCE($42::text, '') (truncated)
2025-01-30 11:46:55
2025-01-30 11:46:55 10:46:55.568 [error] Endpoint query exited for an unknown reason
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 12
- Comments: 22 (3 by maintainers)
I have the same issue: self-hosted Docker version, setup last week, just restarted everything using docker compose and it still gives me:
Same thing in the Edge Functions tab.
@joshenlim @kiwicopple @MildTomato @saltcod @alaister Sorry for tagging, but it seems like no one is paying attention to this, could you please give us a hand here? Thanks in advance 🤘
This bug is due to a translation error for regexp_contains with field references. bugfix will be out soon.
Same problem, let me tell you my situation:
At first, all the lists in the entire Logs panel could not view the logs and prompted
401 unauthorized, just like this issue: #34396 , then according to the answer in it, I updated the studio version to:2025.06.05-sha-671aea0After this version, most of them returned to normal, but onlycronandedgestill reported 502Still not working in the docker version 1.12.0 (in cron and edge functions get 502)
and 1.12.1 ~ 1.13.x all the collection will get 401 error
Unfortunately the issue persists after updating to CLI v2.19.7 and
supabase stop && supabase start.