supabase: Custom Log not working in local Development and other Bug

When I try logging inside Supabase function using raise statement it doesn’t appear inside Postgres tab inside logging.

Reproduce Bug

Add a new say_hello function

CREATE OR REPLACE FUNCTION say_hello()
RETURNS TEXT AS $$
BEGIN
    raise log 'Hello, world!';
    RETURN 'Hello, world!';
END;
$$ LANGUAGE plpgsql;

call say_hello running query select * from say_hello();

Logging No Error Severity Bug

Once l try logging No Error Severity getting error.

Screenshot 2023-11-03 at 11 25 24 PM Screenshot 2023-11-03 at 11 25 10 PM

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 1
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Hi @RyanClementsHax,

Doing various tests I noticed that the timestamp variable appears to be of text type and is expressed in nanoseconds, this is my solution:

select
  to_timestamp(CAST(timestamp AS BIGINT) / 1000000.0) AS timestamp,
  event_message, metadata 
from edge_logs 
limit 5

@Ziinc thanks for that. I’ve confirmed that this is a problem with the default queries.

By default a query like this is presented

select
  cast(timestamp as datetime) as timestamp,
  event_message, metadata 
from edge_logs 
limit 5

Removing the casting fixes it.

select
  timestamp,
  event_message, metadata 
from edge_logs 
limit 5

HI @igorlanko , sorry for the slow reply, but could you share with us more about the log of the analytics container or the studio container? It will be easier to debug.