mirror of
https://github.com/supabase/supabase.git
synced 2026-05-12 11:48:38 -04:00
e9d951a65c
## Problem The edge function logs table at `/observability/logs/edge-functions-logs` did not show which edge function was called. Users had to open individual log entries to find the function name, even though the information is available in the log data. ## Fix - Added `request.pathname` to the SQL SELECT query for `function_edge_logs` so the pathname is returned with each row. - Added `extractEdgeFunctionName` utility that parses the last path segment from the pathname (e.g. `/functions/v1/hello-world-1` becomes `hello-world-1`). - Updated `FunctionsEdgeColumnRender` to display the function name between the HTTP method and the log ID columns. - Added unit tests for `extractEdgeFunctionName` covering normal paths, null/undefined, non-string values, and pathnames without slashes. <img width="1472" height="776" alt="CleanShot 2026-03-19 at 13 18 47@2x" src="https://github.com/user-attachments/assets/e437f7df-7aab-4ea5-b421-95bab3923605" /> ## How to test - Navigate to Logs and Analytics, then Edge Functions logs. - Confirm each row now shows the function name (e.g. `hello-world-1`) between the HTTP method and the log ID. - Confirm rows without a pathname (e.g. non-platform or self-hosted) still render without errors. - Confirm clicking a row still opens the log detail panel correctly. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { Column } from 'react-data-grid'
|
|
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
|
|
|
|
import type { LogData } from '../Logs.types'
|
|
import { extractEdgeFunctionName } from '../Logs.utils'
|
|
import { ResponseCodeFormatter, RowLayout, TextFormatter } from '../LogsFormatters'
|
|
import { defaultRenderCell } from './DefaultPreviewColumnRenderer'
|
|
|
|
const columns: Column<LogData>[] = [
|
|
{
|
|
name: 'functions-edge-first-column',
|
|
key: 'functions-edge-first-column',
|
|
renderHeaderCell: () => null,
|
|
renderCell: (props) => {
|
|
if (!props.row.status_code && !props.row.method) {
|
|
return defaultRenderCell(props)
|
|
}
|
|
const functionName = extractEdgeFunctionName(props.row.pathname)
|
|
return (
|
|
<RowLayout>
|
|
<TimestampInfo utcTimestamp={props.row.timestamp!} />
|
|
<ResponseCodeFormatter value={String(props.row.status_code)} />
|
|
<TextFormatter value={String(props.row.method)} />
|
|
{functionName && <TextFormatter value={functionName} />}
|
|
<TextFormatter value={String(props.row.id)} />
|
|
</RowLayout>
|
|
)
|
|
},
|
|
},
|
|
]
|
|
|
|
export default columns
|