Files
supabase/apps/studio/components/interfaces/Settings/Logs/LogColumnRenderers/DatabaseApiColumnRender.tsx
T
kemal.earthandClaude Sonnet 4.6 9b028f6fd5 feat(studio): map error codes to docs (#43140)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

This introduces a small snippet preview of the error code coming via our
content API for the docs. This appears in a couple of places right now.

- **Auth Overview** - This page isn't fully released yet, but it appears
on the error codes table (as depicted below).
- **Logs** - When you delve into the logs panel, if there's an error
code available, they're also wrapped in this popover.

We are also working on a shared-data package (#43458) to potentially
replace this endpoint internally. Also introduces a multifaceted button
to debug/fix with either Assistant or LLM of choice.

| Auth Overview | Logs Panel |
|--------|--------|
| <img width="407" height="287" alt="Screenshot 2026-03-09 at 14 14 09"
src="https://github.com/user-attachments/assets/7450dddb-6828-4cd3-802d-37d47ba1b440"
/> | <img width="394" height="216" alt="Screenshot 2026-03-09 at 14 13
56"
src="https://github.com/user-attachments/assets/80c2a46e-dbe4-4e88-a0a7-68b977a71d6b"
/> |

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 17:33:14 +00:00

43 lines
1.6 KiB
TypeScript

import { Column } from 'react-data-grid'
import { Service } from 'data/graphql/graphql'
import type { LogData } from '../Logs.types'
import { ResponseCodeFormatter, RowLayout, TextFormatter } from '../LogsFormatters'
import { defaultRenderCell } from './DefaultPreviewColumnRenderer'
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
import { ErrorCodeTooltip } from '../ErrorCodeTooltip'
const columns: Column<LogData>[] = [
{
name: 'database-api-first-column',
key: 'database-api-first-column',
renderHeaderCell: () => null,
renderCell: (props) => {
if (!props.row.status_code && !props.row.method && !props.row.path) {
return defaultRenderCell(props)
}
const error_code = props.row.metadata?.[0]?.response?.[0]?.headers?.[0]?.x_sb_error_code
const service =
typeof props.row.path === 'string' && props.row.path.startsWith('/auth/')
? Service.Auth
: undefined
return (
<RowLayout>
<TimestampInfo utcTimestamp={props.row.timestamp!} />
<ResponseCodeFormatter value={String(props.row.status_code)} />
<TextFormatter value={String(props.row.method)} />
<TextFormatter value={String(props.row.path)} />
{error_code && (
<ErrorCodeTooltip errorCode={String(error_code)} service={service}>
<span className="font-mono text-xs text-destructive-600 truncate shrink-0">
{error_code}
</span>
</ErrorCodeTooltip>
)}
</RowLayout>
)
},
},
]
export default columns