Files
supabase/apps/studio/components/interfaces/Settings/Logs/LogColumnRenderers/FunctionsEdgeColumnRender.tsx
Jordi Enric e9d951a65c feat(logs): show edge function name in logs FE-2798 (#43967)
## 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>
2026-03-20 09:39:22 +01:00

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